Data processing method, apparatus, and system

ABSTRACT

Embodiments of the present invention provide a data management technology. An OSD receives a strip write request sent by a client server, where the strip write request carries a to-be-written strip, a version number of the to-be-written strip, an offset of the to-be-written strip, and an object ID of the to-be-written strip; and the OSD writes the to-be-written strip into a storage location determined by using the object ID, the version number of the to-be-written strip, and the offset of the to-be-written strip. By applying the present invention, a quantity of object IDs can be reduced.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. patent application Ser. No.15/634,819, filed on Jun. 27, 2017, which is a continuation ofInternational Application No. PCT/CN2014/095223, filed on Dec. 27, 2014,the disclosures of which are hereby incorporated by reference in theirentirety.

TECHNICAL FIELD

Embodiments of the present invention relate to the storage field, and inparticular, to a data processing method, apparatus, and system.

BACKGROUND

An object-based storage system is a distributed storage system andincludes a storage server and an object-based storage device (OSD). Theobject-based storage system may also be referred to as an object storagesystem, and the object-based storage device may also be referred to asan object storage device. In the object storage system, an object isused as a most basic content storage unit. Data may be a file or avolume. A file is used as an example, where the file is split intofragments, a file fragment has attribute information, the file fragment,metadata of the file fragment, and an attribute of the file fragment mayjointly constitute an object, and the object is stored in multiple OSDs.

The object storage system provides a snapshot function. A snapshot is acopy of a specified data set, and the copy marks an image ofcorresponding data at a time point (a start time point of the copy).

A file is used as an example. After a snapshot is taken, if an entirefile or a part of data of the file is modified, modified data needs tobe stored in the storage system. In the prior art, an object ID is usedas a unique identifier of an object, and if a same file is updated,updated data needs to be stored in the storage device as a new objectID. If the file is frequently updated, a total quantity of object IDsbecomes very large, which occupies relatively large storage space andincreases a system resource loss.

SUMMARY

The present invention provides a data management technology, which canreduce a total quantity of object IDs and reduce storage space occupiedby the object IDs.

According to a first aspect, an embodiment of the present inventionprovides a data storage method, including: receiving, by an objectstorage device OSD, a strip write request sent by a client server, wherethe strip write request carries a to-be-written strip, a version numberof the to-be-written strip, an offset of the to-be-written strip, and anobject ID of the to-be-written strip, the version number of theto-be-written strip is corresponding to a snapshot ID of a latestsnapshot of a file or a volume to which the to-be-written strip belongs,the offset of the to-be-written strip describes a location of theto-be-written strip in an object to which the to-be-written stripbelongs, and the object ID of the to-be-written strip is an ID of theobject to which the to-be-written strip belongs; and writing, by theOSD, the to-be-written strip into a storage location determined by usingthe object ID, the version number of the to-be-written strip, and theoffset of the to-be-written strip.

According to a second aspect, an embodiment of the present inventionprovides a data storage method, including: receiving, by an objectstorage device OSD, a strip write request sent by a client server, wherethe strip write request carries a to-be-written strip, a version numberof the to-be-written strip, an offset of the to-be-written strip, and anobject ID of the to-be-written strip, the version number of theto-be-written strip is corresponding to a snapshot ID of a latestsnapshot of a file or a volume to which the to-be-written strip belongs,the offset of the to-be-written strip describes a location of theto-be-written strip in an object to which the to-be-written stripbelongs, and the object ID of the to-be-written strip is an ID of theobject to which the to-be-written strip belongs; determining, by theOSD, whether an object determined by using the version number of theto-be-written strip and the object ID is backed up; and if the object isbacked up, writing, by the OSD, the to-be-written strip into a storagelocation determined by using the object ID, the version number of theto-be-written strip, and the offset of the to-be-written strip; or ifthe object is not backed up, creating, by the OSD, a spliced object byusing the to-be-written strip, and then writing the spliced object intoa storage location determined by using the version number of theto-be-written strip and the object ID.

According to a third aspect, an embodiment of the present inventionprovides a data storage method, including: receiving, by an objectstorage device OSD, a strip write request sent by a client server, wherethe strip write request carries a to-be-written strip, a version numberof the to-be-written strip, an offset of the to-be-written strip, and anobject ID of the to-be-written strip, the version number of theto-be-written strip is corresponding to a snapshot ID of a latestsnapshot of a file or a volume to which the to-be-written strip belongs,the offset of the to-be-written strip describes a location of theto-be-written strip in an object to which the to-be-written stripbelongs, and the object ID of the to-be-written strip is an ID of theobject to which the to-be-written strip belongs; determining, by theOSD, whether a strip determined by using the version number of theto-be-written strip, the object ID of the to-be-written strip, and theoffset of the to-be-written strip is backed up; and if the strip isbacked up, writing the to-be-written strip into a storage locationdetermined by using the version number of the to-be-written strip, theobject ID of the to-be-written strip, and the offset of theto-be-written strip; or if the strip is not backed up, backing up datathat is in an object of a base version in the OSD and whose offset isthe offset of the to-be-written strip and size is a size of theto-be-written strip to the storage location determined by using theversion number of the to-be-written strip, the offset of theto-be-written strip, and the object ID of the to-be-written strip, wherean object ID of the object of the base version is the same as the objectID of the to-be-written strip, and a version number of the object of thebase version is a base version number, and writing the to-be-writtenstrip into a storage location determined by using the object ID of theto-be-written strip, the base version number, and the offset of theto-be-written strip.

According to a fourth aspect, an embodiment of the present inventionprovides a data storage method, including: receiving, by an objectstorage device OSD, a strip write request sent by a client server, wherethe strip write request carries a to-be-written strip, a version numberof the to-be-written strip, an offset of the to-be-written strip, and anobject ID of the to-be-written strip, the version number of theto-be-written strip is corresponding to a snapshot ID of a latestsnapshot of a file or a volume to which the to-be-written strip belongs,the offset of the to-be-written strip describes a location of theto-be-written strip in an object to which the to-be-written stripbelongs, and the object ID of the to-be-written strip is an ID of theobject to which the to-be-written strip belongs; determining, by theOSD, whether an object determined by using the version number of theto-be-written strip and the object ID is backed up; and if the object isbacked up, writing, by the OSD, the to-be-written strip into a storagelocation determined by using the object ID, a version number of theobject, and the offset of the to-be-written strip; or if the object isnot backed up, backing up data in an object of a base version in the OSDto a storage location determined by using the version number of theto-be-written strip and the object ID, where an object ID of the objectof the base version is the same as the object ID of the to-be-writtenstrip, and a version number of the object of the base version is a baseversion number, and writing, by the OSD, the to-be-written strip into astorage location determined by using the object ID, the base versionnumber, and the offset of the to-be-written strip.

According to a fifth aspect, an embodiment of the present inventionprovides a data reading method, including: receiving, by an objectstorage device OSD, a strip read request sent by a client server, wherethe strip read request carries a size of a to-be-read strip, an offsetof the to-be-read strip, a version number of the to-be-read strip, andan object ID of the to-be-read strip, the version number of theto-be-read strip is corresponding to a snapshot ID of a latest snapshotof a file or a volume to which the to-be-read strip belongs, and theobject ID of the to-be-read strip is an ID of an object to which theto-be-read strip belongs; determining, by the OSD, whether a stripdetermined by using the object ID, the version number of the to-be-readstrip, and the offset of the to-be-read strip is backed up; and if thestrip is backed up, reading data determined by using the object ID, theversion number of the to-be-read strip, the offset of the to-be-readstrip, and the size of the to-be-read strip, using the read data as theto-be-read strip, and sending the to-be-read strip to the client server;or if the strip is not backed up, searching, one by one according to adescending order of snapshot times of objects, the objects whose objectIDs are the same as the object ID of the to-be-read strip and versionnumbers are different from the version number of the to-be-read stripuntil an object that stores valid data in a storage location determinedby using the offset of the to-be-read strip is found, using the foundvalid data as the to-be-read strip, and sending the to-be-read strip tothe client server, where a version number of the object is correspondingto the snapshot ID that is of the latest snapshot of the file or thevolume to which the to-be-read strip belongs and that exists before theobject is generated.

According to a sixth aspect, an embodiment of the present inventionprovides a data reading method, including: receiving, by the OSD, astrip read request sent by the client server, where the strip readrequest carries a size of a to-be-read strip, an offset of theto-be-read strip, a version number of the to-be-read strip, and anobject ID of the to-be-read strip, the version number of the to-be-readstrip is corresponding to a snapshot ID of a latest snapshot of a fileor a volume to which the to-be-read strip belongs, and the object ID ofthe to-be-read strip is an ID of an object to which the to-be-read stripbelongs; determining, by the OSD, whether an object determined by usingthe object ID and the version number of the to-be-read strip is backedup; and if the object is backed up, reading data determined by using theobject ID, the version number of the to-be-read strip, the offset of theto-be-read strip, and the size of the to-be-read strip, using the readdata as the to-be-read strip, and sending the to-be-read strip to theclient server; or if the object is not backed up, searching, one by oneaccording to a descending order of snapshot times of objects, theobjects whose object IDs are the same as the object ID of the to-be-readstrip and version numbers are different from the version number of theto-be-read strip until an object that stores valid data in a storagelocation determined by using the offset of the to-be-read strip isfound, using the found valid data as the to-be-read strip, and sendingthe to-be-read strip to the client server, where a version number of theobject is corresponding to the snapshot ID that is of the latestsnapshot of the file or the volume to which the to-be-read strip belongsand that exists before the object is generated.

According to a seventh aspect, an embodiment of the present inventionprovides a data processing apparatus, including: a strip requestreceiving module, configured to receive a strip write request sent by aclient server, where the strip write request carries a to-be-writtenstrip, a version number of the to-be-written strip, an offset of theto-be-written strip, and an object ID of the to-be-written strip, theversion number of the to-be-written strip is corresponding to a snapshotID of a latest snapshot of a file or a volume to which the to-be-writtenstrip belongs, the offset of the to-be-written strip describes alocation of the to-be-written strip in an object to which theto-be-written strip belongs, and the object ID of the to-be-writtenstrip is an ID of the object to which the to-be-written strip belongs;and a strip storage module, configured to write the to-be-written stripinto a storage location determined by using the object ID, the versionnumber of the to-be-written strip, and the offset of the to-be-writtenstrip.

According to an eighth aspect, an embodiment of the present inventionprovides a data processing apparatus, including: a strip requestreceiving module, configured to receive a strip write request sent by aclient server, where the strip write request carries a to-be-writtenstrip, a version number of the to-be-written strip, an offset of theto-be-written strip, and an object ID of the to-be-written strip, theversion number of the to-be-written strip is corresponding to a snapshotID of a latest snapshot of a file or a volume to which the to-be-writtenstrip belongs, the offset of the to-be-written strip describes alocation of the to-be-written strip in an object to which theto-be-written strip belongs, and the object ID of the to-be-writtenstrip is an ID of the object to which the to-be-written strip belongs;and a strip storage module, configured to determine whether an objectdetermined by using the version number of the to-be-written strip andthe object ID is backed up, where

if the object is backed up, the strip storage module is furtherconfigured to write the to-be-written strip into a storage locationdetermined by using the object ID, the version number of theto-be-written strip, and the offset of the to-be-written strip; or ifthe object is not backed up, the strip storage module is furtherconfigured to create a spliced object by using the to-be-written strip,and then write the spliced object into a storage location determined byusing the version number of the to-be-written strip and the object ID.

According to a ninth aspect, an embodiment of the present inventionprovides a data processing apparatus, including: a strip requestreceiving module, configured to receive a strip write request sent by aclient server, where the strip write request carries a to-be-writtenstrip, a version number of the to-be-written strip, an offset of theto-be-written strip, and an object ID of the to-be-written strip, theversion number of the to-be-written strip is corresponding to a snapshotID of a latest snapshot of a file or a volume to which the to-be-writtenstrip belongs, the offset of the to-be-written strip describes alocation of the to-be-written strip in an object to which theto-be-written strip belongs, and the object ID of the to-be-writtenstrip is an ID of the object to which the to-be-written strip belongs;and a strip storage module, configured to: determine whether a stripdetermined by using the version number of the to-be-written strip, theobject ID of the to-be-written strip, and the offset of theto-be-written strip is backed up; and if the strip is backed up, writethe to-be-written strip into a storage location determined by using theversion number of the to-be-written strip, the object ID of theto-be-written strip, and the offset of the to-be-written strip; or ifthe strip is not backed up, back up data that is in an object of a baseversion in the data storage apparatus and whose offset is the offset ofthe to-be-written strip and size is a size of the to-be-written strip tothe storage location determined by using the version number of theto-be-written strip, the offset of the to-be-written strip, and theobject ID of the to-be-written strip, where an object ID of the objectof the base version is the same as the object ID of the to-be-writtenstrip, and a version number of the object of the base version is a baseversion number; and write the to-be-written strip into a storagelocation determined by using the object ID of the to-be-written strip,the base version number, and the offset of the to-be-written strip.

According to a tenth aspect, an embodiment of the present inventionprovides a data processing apparatus, including: a strip requestreceiving module, configured to receive a strip write request sent by aclient server, where the strip write request carries a to-be-writtenstrip, a version number of the to-be-written strip, an offset of theto-be-written strip, and an object ID of the to-be-written strip, theversion number of the to-be-written strip is corresponding to a snapshotID of a latest snapshot of a file or a volume to which the to-be-writtenstrip belongs, the offset of the to-be-written strip describes alocation of the to-be-written strip in an object to which theto-be-written strip belongs, and the object ID of the to-be-writtenstrip is an ID of the object to which the to-be-written strip belongs;and a strip storage module, configured to: determine whether an objectdetermined by using the version number of the to-be-written strip andthe object ID is backed up; and if the object is backed up, write theto-be-written strip into a storage location determined by using theobject ID, a version number of the object, and the offset of theto-be-written strip; or if the object is not backed up, back up data inan object of a base version to a storage location determined by usingthe version number of the to-be-written strip and the object ID, wherean object ID of the object of the base version is the same as the objectID of the to-be-written strip, and a version number of the object of thebase version is a base version number, and the strip storage module isfurther configured to write the to-be-written strip into a storagelocation determined by using the object ID, the base version number, andthe offset of the to-be-written strip.

According to an eleventh aspect, an embodiment of the present inventionprovides a data processing apparatus, including: a strip requestreceiving module, configured to receive a strip read request sent by aclient server, where the strip read request carries a size of ato-be-read strip, an offset of the to-be-read strip, a version number ofthe to-be-read strip, and an object ID of the to-be-read strip, theversion number of the to-be-read strip is corresponding to a snapshot IDof a latest snapshot of a file or a volume to which the to-be-read stripbelongs, and the object ID of the to-be-read strip is an ID of an objectto which the to-be-read strip belongs; and a strip reading module,configured to: determine whether a strip determined by using the objectID, the version number of the to-be-read strip, and the offset of theto-be-read strip is backed up; and if the strip is backed up, read datadetermined by using the object ID, the version number of the to-be-readstrip, the offset of the to-be-read strip, and the size of theto-be-read strip, use the read data as the to-be-read strip, and sendthe to-be-read strip to the client server; or if the strip is not backedup, search, one by one according to a descending order of snapshot timesof objects, the objects whose object IDs are the same as the object IDof the to-be-read strip and version numbers are different from theversion number of the to-be-read strip until an object that stores validdata in a storage location determined by using the offset of theto-be-read strip is found, use the found valid data as the to-be-readstrip, and send the to-be-read strip to the client server, where aversion number of the object is corresponding to the snapshot ID that isof the latest snapshot of the file or the volume to which the to-be-readstrip belongs and that exists before the object is generated.

According to a twelfth aspect, an embodiment of the present inventionprovides a data processing apparatus, including: a strip requestreceiving module, configured to receive a strip read request sent by aclient server, where the strip read request carries a size of ato-be-read strip, an offset of the to-be-read strip, a version number ofthe to-be-read strip, and an object ID of the to-be-read strip, theversion number of the to-be-read strip is corresponding to a snapshot IDof a latest snapshot of a file or a volume to which the to-be-read stripbelongs, and the object ID of the to-be-read strip is an ID of an objectto which the to-be-read strip belongs; and a strip reading module,configured to: determine whether an object determined by using theobject ID and the version number of the to-be-read strip is backed up;and if the object is backed up, read data determined by using the objectID, the version number of the to-be-read strip, the offset of theto-be-read strip, and the size of the to-be-read strip, use the readdata as the to-be-read strip, and send the to-be-read strip to theclient server; or if the object is not backed up, search, one by oneaccording to a descending order of snapshot times of objects, theobjects whose object IDs are the same as the object ID of the to-be-readstrip and version numbers are different from the version number of theto-be-read strip until an object that stores valid data in a storagelocation determined by using the offset of the to-be-read strip isfound, use the found valid data as the to-be-read strip, and send theto-be-read strip to the client server, where a version number of theobject is corresponding to the snapshot ID that is of the latestsnapshot of the file or the volume to which the to-be-read strip belongsand that exists before the object is generated.

According to a thirteenth aspect, an embodiment of the present inventionprovides a data storage system, including a client server and an objectstorage device, where the client server is configured to receive a filewrite request, where the file write request carries to-be-written data,an offset of the to-be-written data, and a file name, and theto-be-written data is a part of a file; the client server obtains a fileidentifier FID according to the file name, performs a query on metadataof the file according to the FID to obtain a version number of the file,and uses the version number of the file as a version number of theto-be-written strip, where the version number of the file iscorresponding to a snapshot ID of a latest snapshot of the file; theclient server splits, according to the offset of the to-be-written dataand a size of the to-be-written data, the to-be-written data intomultiple strips that include the to-be-written strip, determines an IDof an object to which the to-be-written strip belongs, obtains an offsetof the to-be-written strip, creates a strip write request, and sends thestrip write request to the object storage device; and the object storagedevice is configured to: receive the strip write request, where thestrip write request carries the to-be-written strip, the version numberof the to-be-written strip, the offset of the to-be-written strip, andan object ID of the to-be-written strip, the version number of theto-be-written strip is corresponding to the snapshot ID of the latestsnapshot of the file to which the to-be-written strip belongs, theoffset of the to-be-written strip describes a location of theto-be-written strip in the object to which the to-be-written stripbelongs, and the object ID of the to-be-written strip is the ID of theobject to which the to-be-written strip belongs; and the OSD writes theto-be-written strip into a storage location determined by using theobject ID, the version number of the to-be-written strip, and the offsetof the to-be-written strip.

According to a fourteenth aspect, an embodiment of the present inventionprovides a data storage system, including a client server and an objectstorage device, where the client server is configured to: receive avolume write request, where the volume write request carriesto-be-written data, an offset of the to-be-written data, and a volumeidentifier ID, and the to-be-written data is a part of a volume; performa query on metadata of the volume according to the volume ID to obtain aversion number of the volume, where the version number of the volume iscorresponding to a snapshot ID of a latest snapshot of the volume;split, according to the offset of the to-be-written data and a size ofthe to-be-written data, the to-be-written data segment into multiplestrips that include a to-be-written strip, determine an ID of an objectto which the to-be-written strip belongs, and obtain an offset of theto-be-written strip; and create a strip write request and send the stripwrite request to the object storage device; and the object storagedevice is configured to: receive the strip write request, where thestrip write request carries the to-be-written strip, a version number ofthe to-be-written strip, the offset of the to-be-written strip, and anobject ID of the to-be-written strip, the version number of the volumeis the version number of the to-be-written strip, the offset of theto-be-written strip describes a location of the to-be-written strip inthe object to which the to-be-written strip belongs, and the object IDof the to-be-written strip is the ID of the object to which theto-be-written strip belongs; where the OSD writes the to-be-writtenstrip into a storage location determined by using the object ID, theversion number of the to-be-written strip, and the offset of theto-be-written strip.

According to a fifteenth aspect, an embodiment of the present inventionprovides a data storage system, including a client server and an objectstorage device, where the client server is configured to receive a filewrite request, where the file write request carries to-be-written data,an offset of the to-be-written data, and a file name, and theto-be-written data is a part of a file; and the client serving apparatusobtains a file identifier FID according to the file name, and performs aquery on metadata of the file according to the FID to obtain a versionnumber of the file, where the version number of the file iscorresponding to a snapshot ID of a latest snapshot of the file;

the client server splits, according to the offset of the to-be-writtendata and a size of the to-be-written data, the to-be-written data intomultiple strips that include a to-be-written strip, determines an ID ofan object to which the to-be-written strip belongs, and obtains anoffset of the to-be-written strip; and creates a strip write request andsends the strip write request to the object storage device; and theobject storage device is configured to: receive the strip write request,where the strip write request carries the to-be-written strip, a versionnumber of the to-be-written strip, the offset of the to-be-writtenstrip, and an object ID of the to-be-written strip, the version numberof the to-be-written strip is corresponding to the snapshot ID of thelatest snapshot of the file to which the to-be-written strip belongs,the offset of the to-be-written strip describes a location of theto-be-written strip in the object to which the to-be-written stripbelongs, and the object ID of the to-be-written strip is the ID of theobject to which the to-be-written strip belongs; determine whether anobject determined by using the version number of the to-be-written stripand the object ID is backed up; and if the object is backed up, writethe to-be-written strip into a storage location determined by using theobject ID, the version number of the to-be-written strip, and the offsetof the to-be-written strip; or if the object is not backed up, create aspliced object by using the to-be-written strip, and then write thespliced object into a storage location determined by using the versionnumber of the to-be-written strip and the object ID.

According to a sixteenth aspect, an embodiment of the present inventionprovides a data storage system, including a client server and an objectstorage device, where the client server is configured to: receive avolume write request, where the volume write request carriesto-be-written data, an offset of the to-be-written data, and a volumeidentifier ID, and the to-be-written data is a part of a volume; performa query on metadata of the volume according to the volume ID to obtain aversion number of the volume, where the version number of the volume iscorresponding to a snapshot ID of a latest snapshot of the volume;split, according to the offset of the to-be-written data and a size ofthe to-be-written data, the to-be-written data segment into multiplestrips that include the to-be-written strip, determine an ID of anobject to which the to-be-written strip belongs, and obtain an offset ofthe to-be-written strip; and create the strip write request and send thestrip write request to the object storage device; and the object storagedevice is configured to: receive the strip write request, where thestrip write request carries the to-be-written strip, a version number ofthe to-be-written strip, the offset of the to-be-written strip, and anobject ID of the to-be-written strip, the version number of theto-be-written strip is corresponding to the snapshot ID of the latestsnapshot of the volume to which the to-be-written strip belongs, theoffset of the to-be-written strip describes a location of theto-be-written strip in the object to which the to-be-written stripbelongs, and the object ID of the to-be-written strip is the ID of theobject to which the to-be-written strip belongs; determine whether anobject determined by using the version number of the to-be-written stripand the object ID is backed up; and if the object is backed up, writethe to-be-written strip into a storage location determined by using theobject ID, the version number of the to-be-written strip, and the offsetof the to-be-written strip; or if the object is not backed up, create aspliced object by using the to-be-written strip, and then write thespliced object into a storage location determined by using the versionnumber of the to-be-written strip and the object ID.

According to a seventeenth aspect, an embodiment of the presentinvention provides a data reading system, including a client server andan object storage device, where the client server is configured to:receive a file read request, where the file read request carries a filename, a size of to-be-read data, and an offset of the to-be-read data,and the to-be-read data is a part of a file; obtain a file identifierFID according to the file name, perform a query on metadata of the fileaccording to the FID to obtain a version number of the file, and use theversion number of the file as a version number of the to-be-read strip,where the version number of the file is corresponding to a snapshot IDof a latest snapshot of a file to which the to-be-read strip belongs;determine, according to the offset of the to-be-read data and the sizeof the to-be-read data, an ID of an object to which the to-be-read stripbelongs, and obtain an offset of the to-be-read strip; and generate andsend a strip read request; and the object storage device is configuredto: receive the strip read request, where the strip read request carriesa size of the to-be-read strip, the offset of the to-be-read strip, theversion number of the to-be-read strip, and an object ID of theto-be-read strip, the version number of the to-be-read strip iscorresponding to the snapshot ID of the latest snapshot of the file towhich the to-be-read strip belongs, and the object ID of the to-be-readstrip is the ID of the object to which the to-be-read strip belongs;determine whether a strip determined by using the object ID, the versionnumber of the to-be-read strip, and the offset of the to-be-read stripis backed up; and if the strip is backed up, read data determined byusing the object ID, the version number of the to-be-read strip, theoffset of the to-be-read strip, and the size of the to-be-read strip,use the read data as the to-be-read strip, and send the to-be-read stripto the client server; or if the strip is not backed up, search, one byone according to a descending order of snapshot times of objects, theobjects whose object IDs are the same as the object ID of the to-be-readstrip and version numbers are different from the version number of theto-be-read strip until an object that stores valid data in a storagelocation determined by using the offset of the to-be-read strip isfound, use the found valid data as the to-be-read strip, and send theto-be-read strip to the client server, where a version number of theobject is corresponding to the snapshot ID that is of the latestsnapshot of the file or a volume to which the to-be-read strip belongsand that exists before the object is generated.

According to an eighteenth aspect, an embodiment of the presentinvention provides a data reading system, including a client server andan object storage device, where the client server is configured to:receive a volume read request, where the volume read request carries avolume ID, a size of to-be-read data, and an offset of the to-be-readdata, and the to-be-read data is a part of a volume; perform a query onmetadata of the volume according to the volume ID to obtain a versionnumber of the volume, and use the version number of the volume as aversion number of the to-be-read strip, where the version number of thevolume is corresponding to a snapshot ID of a latest snapshot of avolume to which the to-be-read strip belongs; determine, according tothe offset of the to-be-read data and the size of the to-be-read data,an ID of an object to which the to-be-read strip belongs, and obtain anoffset of the to-be-read strip; and generate and send a strip readrequest; and the object storage device is configured to: receive thestrip read request, where the strip read request carries a size of theto-be-read strip, the offset of the to-be-read strip, the version numberof the to-be-read strip, and an object ID of the to-be-read strip, theversion number of the to-be-read strip is corresponding to the snapshotID of the latest snapshot of a file or the volume to which theto-be-read strip belongs, and the object ID of the to-be-read strip isthe ID of the object to which the to-be-read strip belongs; determinewhether a strip determined by using the object ID, the version number ofthe to-be-read strip, and the offset of the to-be-read strip is backedup; and if the strip is backed up, read data determined by using theobject ID, the version number of the to-be-read strip, the offset of theto-be-read strip, and the size of the to-be-read strip, use the readdata as the to-be-read strip, and send the to-be-read strip to theclient server; or if the strip is not backed up, search, one by oneaccording to a descending order of snapshot times of objects, theobjects whose object IDs are the same as the object ID of the to-be-readstrip and version numbers are different from the version number of theto-be-read strip until an object that stores valid data in a storagelocation determined by using the offset of the to-be-read strip isfound, use the found valid data as the to-be-read strip, and send theto-be-read strip to the client server, where a version number of theobject is corresponding to the snapshot ID that is of the latestsnapshot of the file or the volume to which the to-be-read strip belongsand that exists before the object is generated.

By applying the present invention, a combination of an object ID and aversion number is used to replace an object ID in the prior art, whichreduces a quantity of object IDs, and reduces a system resource loss.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is an architectural diagram of an object storage system accordingto an embodiment of the present invention;

FIG. 2 is a flowchart of an embodiment of a data processing methodaccording to the present invention;

FIG. 3A and FIG. 3B are schematic diagrams of a strip distributionpolicy according to an embodiment of the present invention;

FIG. 4 is a diagram of an embodiment of a ROW-based strip read solution;

FIG. 5 is a diagram of an embodiment of a COW-based strip read solution;

FIG. 6 is a schematic structural diagram of an embodiment of a storagesystem according to the present invention; and

FIG. 7 is a schematic compositional diagram of an embodiment of astorage system according to the present invention.

DESCRIPTION OF EMBODIMENTS

FIG. 1 illustrates an architectural diagram of an object storage system,which may include a client server 11 and an object storage device 12.The object storage device 12 may provide an object storage service forthe client server 11.

An object-based storage device (OSD) may be referred to as an objectstorage device. In an object storage technology, a storage system iscreated based on the object storage device, and each object storagedevice may have particular intelligence and can automatically managedata distribution on the object storage device.

An object is a basic data storage unit in the system. A file is used anexample, and an object is actually a combination of a part of data ofthe file and attribute information of this part of data, where theattribute information is also referred to as metadata (Meta Data), and afile-based redundant array of independent disks (RAID) parameter, datadistribution, service quality, and the like may be defined. However, ina traditional storage system, a file or a block is used as a basicstorage unit, and in a block storage system, an attribute of each blockin the system further needs to be always tracked, and an objectmaintains an attribute of the object by communicating with the storagesystem. In the object storage device, each object has an objectidentifier (ID), so as to facilitate access to the object.

An OSD has particular intelligence, and may have a CPU, a memory, and astorage medium. Compared with a block device, the OSD may provide adifferent access interface. In a same storage system, there may be oneor more OSDs, and in FIG. 1, two OSDs are used as an example. Currently,a blade structure is internationally and generally used to implement theobject storage device. The OSD may provide three functions:

(1) Data storage: The OSD manages objects and stores the objects in thestorage medium such as a disk, the OSD does not provide a blockinterface access manner, and when a client requests data, data readingand writing is performed by using an object ID and an offset.

(2) Intelligent distribution: The OSD optimizes distribution of locallystored data by using the CPU and the memory that are of the OSD, andsupports data prefetching. Because the OSD can intelligently supportobject prefetching, a data read speed can be optimized.

(3) Management of metadata of each object: The OSD manages metadata ofan object stored in the OSD, where the metadata is recorded in a datastructure that is referred to as an index node (inode), and the metadatagenerally includes information such as an object size and a quantity ofincluded strips. In a traditional network attached storage (NAS) system,the metadata is maintained by a file server. In an object storagearchitecture, the metadata may be managed by a metadata server, or mainmetadata management work in the system may be implemented by the OSD,which reduces costs of a client.

A current storage mode is copy on first write (COFW), which is sometimesreferred to as copy on write (COW) for short. That is, when new data iswritten into a storage location in a storage device for the first time,original data in this storage location is first read and written intoanother storage location (the another storage location is a storagelocation reserved for a snapshot and is referred to as snapshot space),and then the new data is written into the storage device. It can belearned from an execution process of COW that one read operation and twowrite operations need to be performed in this implementation manner.

Redirect on first write (ROW) is another method for storing new data. InROW, the new data is written into a reserved storage location, and astorage location of old data remains unchanged. Compared with COW, onewrite operation can be reduced in ROW.

In the object storage technology, most metadata management work may bedistributed to each intelligent OSD, and each OSD is responsible formanaging distribution and retrieval of locally stored data, where 90% ofmetadata management work is distributed to an intelligent storagedevice, and only 10% of metadata management work is executed by themetadata server, so that performance of metadata management in thesystem is improved. In addition, the OSD is a device connected to anetwork, and includes a storage medium, such as a disk or a magnetictape, and can manage the locally-stored data with enough intelligence. Astorage server directly communicates with the OSD and accesses datastored in the OSD, and because the OSD is intelligent, the file serverdoes not need to get involved.

An object is a combination of data and a data attribute. The dataattribute may be set according to an application requirement, andincludes data distribution, service quality, and the like. The clientserver 11 may be a server based on the NAS protocol or a server storagearea network based on the Storage Area Network (SAN) protocol. That is,this embodiment of the present invention is applicable to both a filesystem and a block system.

For data in network attached storage (NAS) system, the object in thisembodiment of the present invention comes from a file, the file is splitinto multiple fragments, and one fragment and information such as anattribute and metadata that are of this fragment jointly constitute oneobject. Similarly, for data in a storage area network (SAN), a volume issplit into fragments.

In the prior art, an object is determined by using an object ID, andtherefore, an ID of each object is unique. After a same file is updatedfor multiple times, object IDs of a large quantity may be generated, andit requires large storage space to record the object IDs. In theembodiments of the present invention, an object is determined by using acombination of an object ID and a version number. When data of a file isupdated for multiple times, if an offset range of the updated dataremains unchanged, an object ID corresponding to the updated data mayremain unchanged, and only different object version numbers need to beupdated, so that a total quantity of object IDs maintained in a systemis reduced. In addition, in the solutions in the embodiments of thepresent invention, there is a correspondence between an object versionnumber and a snapshot ID, and in an interval of taking two snapshots,all objects in a same file use a same version number regardless of howmany times data in the file is updated, and therefore, the versionnumber occupies very small storage space.

In the prior art, after content of a file or a volume is updated, formetadata of a modification-related object, metadata stored at a filelayer (a semantic layer of a volume for a block system) needs to beupdated, and an amount of updated data is relatively large. In addition,an access node may access an OSD by using a client server, and if alldifferent access nodes can access the modification-related object,metadata synchronization needs to be performed between nodes.Specifically, after an access node updates metadata of an object,another access node may be triggered to integrally update all object IDsin a file in which the modified object is located, and frequentsynchronization causes severe metadata expansion. However, in thesolutions provided in the embodiments of the present invention, anobject ID does not need to be changed, only a version number needs to beupdated at an OSD layer, and an amount of updated data is far less thanthat in the prior art. In addition, the object ID in the embodiments ofthe present invention is obtained by means of calculation by using anoffset.

As shown in FIG. 2, a file request is used as an example to specificallydescribe a flowchart of an embodiment of a data processing methodaccording to the present invention. In another implementation manner,each term about a file system is replaced with a corresponding termabout a block system. For example, a file is replaced with a volume,file metadata is replaced with volume metadata, a file version number isreplaced with a volume version number, and a file ID is replaced with avolume ID. Differences lie in that: (1) the volume metadata is stored inanother location, not stored in an inode; (2) the volume ID may bedirectly obtained and does not need to be obtained by means ofconversion from a volume name.

Step 20: Create a snapshot, where a target of the snapshot is a file ora file system that includes files, that is, the target of the snapshotincludes the files; and allocate a snapshot ID to the snapshot.

The snapshot is created in two manners. In one manner, a snapshot of afile is created, and the target of the snapshot is a single file. In theother manner, a snapshot of a file system is created, and the target ofthe snapshot is an entire file system, where the file system includesmultiple files. In the two manners, storage locations of file metadataare different.

In the manner of creating a snapshot of a file, a file is selected tocreate a snapshot, a snapshot name is set for the file, and if thesnapshot name has not been used, the snapshot ID is allocated to thesnapshot of the file. The snapshot ID of the file is used as metadata ofthe file and stored in an inode (index node) of the file. It should benoted that the snapshot ID is a mark of the snapshot. For example, atime point for creating the snapshot is used as the snapshot ID, orincreasing numbers are used as snapshot IDs according to an order oftime points for creating snapshots.

In the manner of creating a snapshot of a file system, a file system isselected to take a snapshot, and if a snapshot name has not been used,the snapshot ID is allocated to the snapshot of the file system, andthen the allocated snapshot ID is stored in a root inode of the filesystem. In this manner, it may be considered that a snapshot ID of eachfile in the file system is the same as the snapshot ID of the filesystem. A difference from the previous manner lies in that the snapshotID of the file is stored in the root inode of the file system, but notin the inode of the file.

In addition to the snapshot ID of the file, the file metadata furtherincludes a file identifier (FID), and the file metadata may furtherinclude information such as a file size (Size) and a writing time.

It should be noted that step 20 is a preset step and has relativeindependence from other steps in this method embodiment. This embodimentof the present invention mainly describes operations performed by aclient server and an OSD after a snapshot is created and before a nextsnapshot is created.

Step 21: A client server receives a file write request, where the filewrite request carries to-be-written data, an offset of the to-be-writtendata, and a file name, and the to-be-written data is a part of a file.

Specifically, this step may be executed by a program in a file system ofthe client server. The file write request is a write request that can beidentified by the file system. The file write request may be creating afile, or using the to-be-written data to update a file that alreadyexists, where the to-be-written data is a part of the file or the entirefile.

The file write request may further carry a size of the to-be-writtendata, so that the to-be-written data is split into a strip according tothe offset of the to-be-written data in a subsequent step; or may notcarry a size of the to-be-written data, because the size of theto-be-written data can be obtained by measuring the to-be-written data.

The offset of the to-be-written data describes a relative location ofthe to-be-written data in the file. Specifically, the offset of theto-be-written data may describe a distance between a start location ofthe to-be-written data and a file header. If the offset of theto-be-written data is 0, it indicates that the start location of theto-be-written data is a start location of a to-be-written file. If theoffset of the to-be-written data is 1 KB, it indicates that a distancebetween the start location of the to-be-written data and the startlocation of the file is a data size of 1 KB.

Optionally, the file write request may further carry a file path of thefile write request, where the file path indicates storage locations ofthe file and a mapping relationship table. A file is jointly determinedby using a file path and a file name. For example, a combination of thefile path and the file name is /root/mma/a1, where /root/mma/ is thefile path, a1 is the file name, and the file and the mappingrelationship table are stored in the path /root/mma/.

Different files may have different file names, and file names in a samefile path are not the same.

Optionally, the write request may further carry a storage location of amapping relationship table, where the mapping relationship table recordsa mapping relationship between the file name and the FID.

A snapshot ID is generated each time a snapshot is created, eachsnapshot ID has a corresponding file version number, and the snapshot IDis in a one-to-one correspondence with the file version number. Inaddition, a change rule of snapshot IDs corresponding to adjacentsnapshot times is the same as a change rule of file version numberscorresponding to the adjacent snapshot times.

Before step 22 is executed, a mapping relationship between the snapshotID and the file version number may be recorded.

The following two steps are included:

(1) Back up currently newest file metadata, which may be specificallyimplemented by backing up an inode. For a snapshot of a file level, aninode of a file is backed up, and for a snapshot of a file system level,an inode of a file system is backed up, including both an inode of afile and a root inode of the file.

(2) Update a version number in the inode. If a write mode that is set inthe client server is ROW, the updated version number is stored in thebacked-up inode. If a write mode that is set in the client server isCOW, the updated version number is stored in an inode that is generatedby means of backup, and optionally, the backed-up inode may also recordthe updated version number. For example, if an inode A is backed up togenerate an inode B, the inode A is a backed-up inode, and the inode Bis an inode that is generated by means of backup.

The snapshot ID is generated in step 20. There is a correspondencebetween the file version number and the snapshot ID, and the snapshot IDis corresponding to a snapshot time; therefore, it may also beconsidered that there is a correspondence between the file versionnumber and the snapshot time. The correspondence means that each fileversion number is corresponding to one unique snapshot ID, and a changerule of the file version number is similar to that of the snapshot ID.For example, a larger snapshot ID indicates a larger file versionnumber, or a larger snapshot ID indicates a smaller file version number.A snapshot with a later snapshot time among multiple snapshots has alarger ID.

It should be noted that, in a data writing method based on a blocksystem, including a SAN, a volume is marked by using a volume ID insteadof a file name, and a function of the volume ID is similar to that ofthe FID. In addition, in the volume, there is no concept similar to thefile path. Therefore, a step of performing a query on the mappingrelationship table is no longer required in step 22, and a query may bedirectly performed on volume metadata by using the volume ID to obtain avolume version number.

Step 22: The client server performs a query on a mapping relationshiptable by using the file name, to obtain a file identifier (FID) of thefile in which the to-be-written data is located, and performs a query onfile metadata according to the FID to obtain a file version number.

The mapping relationship table records a mapping relationship betweenthe file name and the FID, and the file name is in a one-to-onecorrespondence with the FID. The storage location of the mappingrelationship table may be carried in the file write request and isobtained by the client server from the write request, or the mappingrelationship table may be prestored in the client server by the clientserver, and the client server finds the mapping relationship tableaccording to the file path, or the mapping relationship table may bestored in another storage device.

The obtained file version number may be further updated to the metadata.After the update, the file metadata records the FID and the file versionnumber, and the file version number may be obtained by performing aquery on the file metadata by using the FID. The file metadata may bestored in information about an inode. The file path indicates a storagelocation of the inode. It can be learned from the foregoing descriptionthat, for ROW, because the version number is stored in the backed-upinode, the backed-up inode is read in this step. For COW, because theversion number is stored in the inode that is generated by means ofbackup, the inode that is generated by means of backup is read in thisstep.

There is a one-to-one correspondence between the file version number andthe snapshot ID of the file, and after generating the snapshot ID, theclient server generates the file version number that is in a one-to-onecorrespondence with the snapshot ID. For example, the snapshot ID may bedirectly used as the file version number, or a snapshot ID obtainedafter an operation is performed may be used as the file version number.If a snapshot that is created later has a larger snapshot ID, anoptional manner is: the snapshot that is created later has a largervalue of the snapshot ID; another optional manner is: the snapshot thatis created later has a smaller value of the snapshot ID.

In the embodiments of the present invention, sometimes a version numberof a to-be-written strip is also used. The version number of theto-be-written strip is a file version number of a file to which theto-be-written strip belongs. That is, strip version numbers of differentstrips from a same file are the same. Similarly, an object versionnumber (or a version number of an object) is the file version number ofthe file to which the to-be-written strip belongs. That is, objectversion numbers of different objects from a same file are the same.

Step 23: The client server splits the to-be-written data into multiplestrips that include a to-be-written strip, and obtains, according to astrip distribution policy, an offset of the to-be-written strip and anID of an object to which the to-be-written strip belongs, where the IDof the object to which the to-be-written strip belongs is also referredto as an object ID.

The client server splits the data into one or more strips according to astrip size. A strip is data of a particular size. When the size of theto-be-written data is less than or equal to a size of a single strip,the to-be-written data is split into one strip; if the size of theto-be-written data is greater than the size of the single strip, theto-be-written data is split into multiple strips. Sizes of strips splitfrom a same file are the same. The strip size may be stored in the filemetadata, and in this case, different files may use different stripsizes. Alternatively, the strip size may not be stored in the metadataof the file to which the object belongs, files in the entire file systemshare one strip size, and in this case, different files use a same stripsize, and the strip size is stored in the root inode of the file system.An object may be considered as a container, which can accommodate astrip.

For example, if the to-be-written data is split into several datastrips, the strip in this step refers to a data strip obtained by meansof splitting; or after the to-be-written data is split into a datastrip, if several verification strips are further generated to performdata protection on the data strip, the strip in this step includes boththe data strip and the verification strip.

A total quantity of strips included in each object may be stored in thefile metadata, and in this case, a total quantity of strips included inobjects in different files may be different; or a total quantity ofstrips included in each object may not be stored in the metadata of thefile to which the object belongs, and in this case, a total quantity ofstrips included in objects in different files is the same.

It should be noted that a start location of the to-be-written data inthe file may be learned from the offset of the to-be-written data, andan end location of the to-be-written data in the file may be learnedfrom the offset of the to-be-written data and the size of theto-be-written data. If the start location of the to-be-written data isnot an integer multiple of the strip size, or a value of the endlocation plus 1 is not an integer multiple of the strip size, theto-be-written data is first split according to the strip size, andsplitting boundaries are integer multiples of the strip size. If datawhose size is less than one strip (this type of data may also bereferred to as dirty data of a strip) is generated after splitting, thedata is supplemented to form a strip. Because of a supplementingoperation in this step, unless otherwise specified, both a strip and anoffset of the strip that are mentioned in a subsequent step refer to astrip and an offset of the strip that are obtained after supplementing.

For example, if an offset range of the to-be-written data is 4 KB-300KB, and the strip size is 256 KB, 0 KB and 256 KB are used as boundariesfor splitting the to-be-written data, and two data blocks are formed,where offset ranges of the two data blocks in the to-be-written data arerespectively 4 KB-255 KB and 256 KB-300 KB. Supplementing is performedon the two data blocks, and two strips whose sizes are 256 KB areformed. Data (whose size is 4 KB−0 KB=4 KB) used to supplement a formerdata block comes from a previous strip, and data (whose size is 511KB−300 KB=211 KB) used to supplement a latter data block comes from anext strip. The offset of the to-be-written data is a relative locationof the to-be-written data in the file.

Another supplementing method is as follows: If the start location of theto-be-written data is not an integer multiple of the strip size, or avalue of an end location offset plus 1 is not an integer multiple of thestrip size, a supplementing operation may be performed on theto-be-written data of strip, so that sizes of strips obtained aftersplitting are consistent and there is no margin in the strip. Data thatis already stored in the OSD may be read and used as data forsupplementing.

For example, if an offset range of the to-be-written data is 4 KB-300KB, and the strip size is 256 KB, the to-be-written data may besupplemented to form data whose offset range is 0 KB-511 KB, and thenthe data is split into two strips whose offset ranges are 0 KB-255 KBand 256 KB-511 KB, so that a size of each strip is 256 KB.

The strip distribution policy is provided by the file system of theclient server. What is described is the object to which the stripbelongs, that is, a correspondence between the strip and the object,which specifically may be a correspondence between the offset of thestrip and the object.

An object ID uniquely identifies an object, IDs of objects that belongto a same file are different, and IDs of objects in different files arealso different.

Optionally, there may be a correspondence between the object ID and theFID of the file to which the object belongs. That is, for example, afile from which an object represented by this object ID comes may belearned from the object ID.

For example, an optional manner for generating the object ID is asfollows: The object ID includes binary numbers of 64 bits, where former32 bits are an ID of the file to which the object belongs, latter 32bits are assigned by the client server, the latter 32 bits are unique inthe file, and latter 32 bits of different objects in a same file aredifferent. For example, an identifier of an object in a file is used. Inthis manner, the corresponding FID may be learned from the former 32bits of the object ID. Similarly, in the block system, a relationshipbetween an object ID and a volume ID may also be established.

Another optional manner for generating the object ID is as follows: Theobject ID includes binary numbers of 48 bits, where former 16 bits arecorresponding to the file, and former 16 bits of different files aredifferent; latter 32 bits are assigned by the client server, the latter32 bits are unique in the file, and latter 32 bits of different objectsin a same file are different.

In another embodiment, there may also be no correspondence between theID and the FID of the file to which the object belongs.

FIG. 3A and FIG. 3B show two different strip distribution policies. Astrip index describes an offset relationship of a strip in a file, andthe strip index is an integer greater than or equal to 0, where thesmallest strip index is 0, the second smallest strip index is 1, and thethird smallest strip index is 2, . . . , and so on. Two strips withadjacent index values also have adjacent offsets in the file.

An optional strip distribution policy is shown in FIG. 3A: (1) sizes ofobjects that belong to a same file are fixed, and sizes of strips in asame file are the same, which means that a total quantity of stripsincluded in different objects is the same; (2) a previous object isfirst filled and then a next object is filled by strips according to anindex order, that is, several consecutive strips belong to a same objectaccording to an order of offset sizes of strips in the to-be-writtendata. As shown in FIG. 3A, each object fixedly includes four strips. Forexample, a strip size is 256 KB, and each object has four strips, thatis, an object size is 256 KB×4=1024 KB. In this case, the first objectstores the strip 0 to strip 3, the second object stores the strip 4 tothe strip 7, and the third object stores the strip 8 to strip 11, . . .and accordingly, an ID of the first object is 0, an ID of the secondobject is 1, and an ID of the third object is 2, . . . .

A strip offset is used to describe a relative location of a strip in anobject, and may be specifically a relative location of start data of thestrip in the object. Strip offset=(Strip index % Quantity of strips inan object)×Strip size, where % refers to calculating a remainder afterdivision of a former term by a latter term. Therefore, a value of “Stripindex % Quantity of strips in an object” is a remainder obtained afterthe strip index is divided by the quantity of strips in the object.

Another optional strip distribution policy is shown in FIG. 3B: (1)sizes of objects in a same file are not fixed, that is, a total quantityof strips in different objects of the same file may be different; (2) atotal quantity of objects is fixed, that is, different files haveobjects of a same quantity, and as shown in FIG. 3B, there are threeobjects in total. For example, if a strip size is 256 KB, and a totalquantity of objects is fixed to 3, the first strip (strip 0) is locatedin the first object (object 0), the second strip (strip 1) is located inthe second object (object 1), . . . , and by analogy, the fourth strip(strip 3) is also located in the first object, and the fifth strip(strip 4) is also located in the second object. A strip index is aninteger greater than or equal to 0, and describes a locationrelationship between strips in a file. An offset of each strip in anobject to which the strip belongs may also be determined, and anidentifier of an object in the file may be a remainder obtained afterthe strip index is divided by a total quantity of objects in the file. Aspecific calculation formula may be: Identifier of an object in afile=Strip index % Quantity of objects in a file, and Stripoffset=(Strip index/Quantity of objects)×Strip size.

The strip index may be determined by using the offset of theto-be-written data. For example, for an entire file, start data obtainedafter the file is split is located in a strip (strip 0) in the firstobject, and the offset of the current to-be-written data is located inthe fifth strip (strip 4) in the object 1. In this case, in stripsgenerated after the to-be-written data is split, an index of the firststrip is 4, and an index of another strip is obtained by analogy.

The foregoing describes two solutions for calculating the ID of theobject to which the strip belongs, and according to different stripdistribution policies, there may also be another implementationsolution. Parameters used in different distribution policies may bedifferent, and these parameters may be generally obtained by performinga query on the client server.

Because processing manners of all strips are the same, the followinguses only a particular “to-be-written strip” as an example fordescription.

Step 24: The client server selects an OSD used to store theto-be-written strip.

Specifically, this step may be executed by an object storage client ofthe client server.

An optional calculation method is determining, according to the FID ofthe to-be-written strip, the OSD for storing the to-be-written strip.For example, a hash value of the FID is divided by a total quantity ofOSDs, and a remainder is used as an identifier of the OSD for storingthe to-be-written strip, that is, the hash value of the FID mod thetotal quantity of OSDs. There may also be another solution. For example,the client server randomly selects an OSD to store a to-be-written stripthat belongs to an object, and strips that belong to a same object maybe stored in a same OSD.

In addition, the OSD for storing the strip may also be jointlydetermined according to the FID and an object ID that are of theto-be-written strip. Actually, a calculation method may be randomlyselected provided that an OSD can be selected.

Step 25: The client server sends a strip write request to the OSD, wherethe strip write request carries the to-be-written strip, a versionnumber of the to-be-written strip, the offset of the to-be-writtenstrip, and the ID of the object to which the to-be-written stripbelongs, and optionally, may further include a size of the to-be-writtenstrip.

Optionally, in a case in which the OSD supports both ROW and COW, awrite mode may be further sent, so that the OSD writes the to-be-writtenstrip according to the write mode specified by the client server. Thewrite mode is ROW or COW. If the OSD supports only one write mode, thewrite mode may not be sent to the OSD.

Step 26: The OSD receives the strip write request and writes theto-be-written strip into a storage medium of the OSD.

When the OSD supports only one write mode, the OSD may directly writethe to-be-written strip into the storage medium in a default write modewithout a need to confirm whether the write mode is ROW or COW.

When receiving data, the OSD first temporarily stores the data in abuffer, and in this step, the to-be-written data in the buffer may bestored in the storage medium.

A strip offset describes a relative location of a strip in an object,which, specifically, may be a relative location of start data of thestrip in the object, and Strip offset+Strip size=Relative location ofend data of a strip in an object.

A backup mark of data is in the OSD, and a granularity of the backupmark of the data may be queried in the OSD by using the object ID as anindex, or it may be set by default that all strips received by the OSDare stored according to a same granularity of the backup mark. Stripsthat belong to a same file use a same type of recording granularity. Anactual device may support only a case in which an object is used as thegranularity of the backup mark, or may support only a case in which astrip is used as the granularity of the backup mark. In this case, theOSD may directly perform storing without a need to query the granularityof the backup mark.

In the OSD, an object can be jointly determined by using two parameters:an object ID and a version number, and therefore, a set that includesthe two parameters is referred to as an object key parameter in thisembodiment. After the object is determined, a strip may be determined byfurther using a strip offset, that is, a strip can be jointly determinedby using three parameters: the object ID, the version number, and thestrip offset, and therefore, a set that includes the three parameters isreferred to as a strip key parameter.

In the OSD, the object key parameter may indicate a storage locationthat is used to store an object, and specifically, may indicate a startaddress that is to be used by the object. Optionally, the object keyparameter may indicate an address segment that is to be used by theobject. Similarly, the strip key parameter may also indicate a startaddress or an address segment that is used to store a strip. The startaddress and the address segment may be physical addresses or logicaladdresses.

There are multiple possible cases of searching, by using the object keyparameter, for a storage location of an object determined by using theobject key parameter. In one case, before receiving the strip writerequest, the OSD already records an object key parameter carried in thestrip write request, and allocates a storage location for a striprepresented by this group of key parameters. In another case, the OSDdoes not record this group of key parameters, and does not allocate thestorage location for the strip represented by this group of keyparameters, and after receiving the strip write request, the OSDallocates a storage location to this group of object key parameters.

An object set is a set of objects with a same object ID and differentversion numbers, where the object set includes at least one object, andthe object set may be a logic concept and does not need to be actuallydivided.

An object ID is determined according to a range of an offset that is ofdata carried in an object and that is in a file. If multiple snapshotsof a same file are taken, and data that changes is stored in an OSD eachtime a snapshot is taken, data with a same offset among the data thatchanges has a same object ID.

In the OSD, a mark is used to indicate whether an object or a strip isbacked up. A granularity of a backup mark may be a strip or an object.If a smallest marked unit is a strip, the granularity of the backup markis a strip, and if a smallest marked unit is an object, the granularityof the backup mark is an object.

A backup mark of an object indicates that an object determined by usingan object ID and a version number has already been backed up.Specifically, the backup mark of an object indicates whether an objectcorresponding to the object ID is backed up after a snapshotcorresponding to the version number is created, where 1 indicates thatthe object has been backed up, and 0 indicates that the object has notbeen backed up. There are specifically two cases in which the backupmark of the object is 0, where one case is that the object determined byusing the object ID and the version number is modified and a backupoperation is not executed yet; the other case is that the objectdetermined by using the object ID and the version number is notmodified.

A backup mark of a strip indicates that a strip determined by using anobject ID, a version number, and a strip offset has already been backedup. Specifically, the backup mark of a strip indicates whether a stripcorresponding to the object ID and the strip offset is backed up after asnapshot corresponding to the version number is created, where 1indicates that the strip has been backed up, and 0 indicates that thestrip has not been backed up. There are specifically two cases in whichthe backup mark of the strip is 0, where one case is that the stripdetermined by using the object ID, the version number, and the stripoffset is modified and a backup operation is not executed yet; the othercase is that the strip determined by using the object ID, the versionnumber, and the strip offset is not modified.

By comparing object version numbers, snapshot times of different objectsin a same object set may be determined.

There are four possible manners in total in which the to-be-writtenstrip is written into the OSD: (1) The write mode is ROW, and thegranularity of the backup mark is a strip. (2) The write mode is ROW,and the granularity of the backup mark is an object. (3) The write modeis COW, and the granularity of the backup mark is a strip. (4) The writemode is COW, and the granularity of the backup mark is an object. An OSDmay support one or more of the four possible manners. The followingseparately describes the four possibilities.

Manner 1: For ROW, the Granularity of the Backup Mark of the Data in theOSD is a Strip.

The to-be-written strip is directly written into the OSD according to astorage location determined by using a strip key parameter in the striprequest. In addition, after writing is complete, the storage location (astart storage address or an address segment) occupied by the writtenstrip may be further marked as “written valid data” in this step. Astorage location occupied by the strip stored in the storage medium ofthe OSD is also referred to as strip space.

A bit may be used to mark whether each strip in an object is backed up.For example, a flag bit of a storage location of this strip is set to 1,where 1 indicates that data is written, and 0 indicates that there is nodata. A strip index may be used to describe an order of strips in anobject, and a flag bit is used to mark each strip in the object. Forexample, there are four pieces of strip space in total, where 0000indicates that no data is written into the four pieces of strip space;0010 indicates that data is written into only the second piece of stripspace; 0101 indicates that data is written into the first piece of stripspace and the third piece of strip space, and no data is written intothe second piece of strip space and the fourth piece of strip space.

It should be noted that the N^(th) (N is a natural number) piece ofstrip space described in this embodiment refers to a relative locationof the strip space in an object to which a strip belongs, and does notrefer to a strip index.

In a method for determining an identifier of a strip in an object, forexample, an offset of the strip may be used for determining, a smalleroffset value indicates a smaller strip identifier value, a differencebetween identifiers of adjacent strips is 1, and the smallest stripidentifier is 0. If the strip distribution policy is the policydescribed in FIG. 3A in this step, a quick calculation method fordetermining a strip identifier is: Strip identifier=Strip offset/Stripsize. The strip offset is an offset of a strip in an object. If thispiece of strip space has already been marked as “backed up” before,marking may be not repeatedly performed in this step provided that thismark remains unchanged.

Manner 2: For ROW, the Granularity of the Backup Mark of the Data in theOSD is an Object.

The granularity for determining the backup mark in Manner 2 is differentcompared with that in Manner 1, and determining a flag bit of a strip ischanged into determining a flag bit of an object.

A query is performed in a writing record in the OSD by using an objectkey parameter carried in the strip write request, to determine whethervalid data is stored in a storage location indicated by the object keyparameter. In this embodiment, it may be determined, by determining aflag bit, whether valid data is stored in a storage location. Forexample, if the flag bit is 1, it indicates that valid data is stored,and if the flag bit is 0, it indicates that no valid data is stored inthe storage location. It may be determined, by determining the flag bitof the storage location indicated by the object key parameter, whetherthe strip write request received this time is the first write operationperformed on this object after a snapshot is created. For example, whenthe flag bit is 0 or no flag bit is found, it indicates that the firstwriting after the snapshot is taken, and when the flag bit is 1, itindicates that non-first writing after the snapshot is taken.

If the strip write request is not the first writing performed on thisobject after the snapshot is taken, the to-be-written strip is directlywritten into a storage location occupied by this object, and a specificwriting location may be determined by using the strip key parameter.

If the strip write request is a write request that is for this objectand that is received for the first time after the snapshot of thisobject is taken, the to-be-written strip in the strip write request anda combination of strips obtained from another object in the OSD arespliced into a complete object that is referred to as a spliced object.Specifically, an object from which the remaining part comes is an objectwith a largest version number (but is smaller than a version numbercarried in the strip request) in objects that have valid data.

That is, an object with a largest version number is selected from anobject that has valid data and that belongs to an object set of theobject ID of the to-be-written strip, and a strip whose offset isdifferent from the offset of the to-be-written strip is obtained, toconstitute the spliced object jointly with the to-be-written strip. Aset of an object that is stored in the OSD and whose object ID is thesame as the object ID of the to-be-written strip and version number isdifferent from the version number of the to-be-written strip is referredto as the object set of the object ID of the to-be-written strip. Whenthe write mode is ROW, a later snapshot time indicates a largercorresponding object version number, and the object ID of theto-be-written strip is the ID of the object to which the to-be-writtenstrip belongs.

For example, each object includes 32 strips, and the to-be-written stripreceived by the OSD is the 15^(th) strip in the 32 strips, and for theremaining 31 strips, that is, objects from which the 1^(st) to the14^(th) strips and the 16^(th) to the 32^(th) strips come are objectsthat are recorded in the OSD after a previous snapshot is taken and thathave valid data and a same object ID.

After writing is complete, a flag bit of this object is recorded asbacked up. For example, the flag bit is set to 1, which means that thefirst strip write operation after the snapshot is taken is complete,that is, if any strip in this object is written again before a nextsnapshot is taken, it is not the first writing performed on this objectafter the snapshot is taken, and therefore, there is no need to performa backup operation, and the strip is directly written.

It can be learned from the foregoing description that a same object IDmay corresponding to multiple objects, each snapshot ID is correspondingto one object, these objects are written into the OSD at differenttimes, version numbers of objects with adjacent writing times areadjacent, and a later writing time indicates a larger version number.

After this write operation is complete, the object newly written thistime is a new member in the object set.

Manner 3: The Write Mode is COW, and the Granularity of the Backup Markof the Data is a Strip.

A storage location may be determined by using an object key parameter inthe strip write request and the strip offset. It is first detectedwhether data is already stored in the storage location determined byusing the key parameter of the to-be-written strip, and if a result ofdetermining is that the data is not stored in the storage locationdetermined by using the key parameter of the to-be-written strip or thatno record is found, it means that this write request is the first writerequest after the snapshot is created, and a backup operation needs tobe first performed and then the to-be-written strip is written.

In a general case, before a next snapshot is taken and after only thefirst strip write request is received, strip data needs to be backed up,and the data is backed up to a storage location determined by using theobject ID of the to-be-written strip, the version number of theto-be-written strip, and the offset of the to-be-written strip.Therefore, a newest strip stored in the OSD needs to be first backed upto the storage location indicated by the key parameter of theto-be-written strip, and a strip received this time is then written intothe storage location in which data is backed up. The newest strip storedin the OSD is a latest strip that is sent by the client server. In thisembodiment, the newest strip is a strip that is in strips stored in theOSD and has the object ID of the to-be-written strip and whose versionnumber is 0 and offset is the same as the offset of the to-be-writtenstrip. A write operation of the to-be-written strip may be directlyperformed if a strip write request is subsequently received, and backupdoes not need to be performed.

In COW, a newest object stored in the OSD always uses a same versionnumber. For example, 0 or null is used as the version number, which isreferred to as a base version number in this embodiment. Among otherobjects in the object set and among version numbers except the baseversion number, an object with a smaller version number has a latercorresponding snapshot time.

In ROW or COW, before the first snapshot of a file is taken, when datais written into the OSD, a used strip version number is the base versionnumber. A value of the base version number may be 0 or null.

After the backup operation is complete, it is marked that a storagelocation indicated by a strip key parameter carried in the strip writerequest already stores data. Before a next snapshot is taken, if the OSDreceives a COW write request for a location of the offset of thisto-be-written strip again, data may not be migrated any more, and areceived strip is written, in an overwriting manner, into a storagelocation that is in an object whose version number is 0 and that isoccupied by the offset of the to-be-written strip. In other words, theto-be-written strip is written into a storage location determined byusing the object ID of the to-be-written strip, the base version number,and the offset of the to-be-written strip.

In addition, in this step, it may be further marked that the storagelocation into which the to-be-written strip is written already storesvalid data, and for a specific marking method, reference may be made toManner 1.

Manner 4: The Write Mode is COW, and the Granularity of the Backup Markof the Data in the OSD is an Object.

A difference between Manner 4 and Manner 3 is: the granularity of thebackup mark of the data is changed from a strip into an object, and abackup granularity is also changed from a strip into an object.

A storage location may be determined by using an object key parameter inthe strip write request. The OSD performs a query in a writing record ofthe OSD by using the object key parameter, and determines whether validdata is stored in the storage location indicated by the object keyparameter of the to-be-written strip. Similar to the description inManner 1, a flag bit may be used to mark an object in this embodiment.For example, a flag bit 1 indicates that valid data is stored, and if aflag bit is 0 or no flag bit of the object key parameter is found in thewriting record of the OSD, it indicates that no valid data is stored.

In a general case, before a next snapshot is taken, and after only thefirst strip write request is received, object data needs to be backedup. Specifically, if valid data is stored, it means that an objectjointly determined by using the object ID of the to-be-written strip andthe version number of the to-be-written strip is already backed up afterthe snapshot is created, and backup does not need to be performed again;if no valid data is stored or no record of the object key parameter inthe strip write request is found in the OSD, it means that backup needsto be first performed in this step, and then the to-be-written strip inthe strip write request received this time can be written.

If valid data is already stored in the storage location indicated by theobject key parameter, the to-be-written strip is directly written into alocation jointly determined by using the object ID of the to-be-writtenstrip, a version number 0, and the offset of the to-be-written strip.

If no valid data is stored in the storage location indicated by theobject key parameter, all strips in an object of version 0 are firstbacked up to the storage location indicated by the object key parameterin the strip write request. After the backup is complete, the storagelocation indicated by the object key parameter in the strip writerequest is marked as 1, and then the to-be-written strip is written intoa storage location that is previously occupied by the object of version0, where a writing location is determined by using the object ID of theto-be-written strip, the version number of the to-be-written strip, anda base version number.

After step 26 is executed, the OSD sends, to the client server, aresponse message indicating that the to-be-written strip is successfullystored.

It should be noted that step 26 is executed before a next snapshot istaken. That is, steps 21 to 26 are executed after the first snapshot istaken and before a next snapshot is taken. Steps 21 to 26 are aprocedure of writing the to-be-written strip into the OSD. The followingdescribes how to read the strip that is already written into the OSD,and a read process and a write process are two relatively independentmethods.

Step 27: The client server receives a file read request, where the fileread request carries a file name, a size of to-be-read data, and anoffset of the to-be-read data.

Similar to the file write request, the file read request may furthercarry a file path of the file read request, where the file path recordsa storage location of a mapping relationship table. A file may beuniquely determined by using the file path and the file name.

Specifically, this step may be executed by a program in the file systemof the client server. The file read request is a read request that canbe identified by the file system. The file read request requests to reada complete file or a part of data of a file.

The offset of the to-be-read data describes a relative location of theto-be-read data in the file. Specifically, the offset of the to-be-readdata may describe a distance between a start location of the to-be-readdata and a file header. If the offset of the to-be-read data is 0, itindicates that the start location of the to-be-read data is a startlocation of a to-be-read file. If the offset of the to-be-read data is 2KB, it indicates that a distance between the start location of theto-be-read data and the start location of the file is a data size of 2KB.

Optionally, the file read request may further carry a file path, wherethe file path records a storage location of a mapping relationshiptable. For details of the mapping relationship table, refer to thedescription of step 21.

The file name may be a file name of a file in which the to-be-read datais located, or may be a file name of a snapshot of a file in which theto-be-read data is located. If the file name is the file name of thefile in which the to-be-read data is located, it indicates that the fileread request is intended to access newest to-be-read data; if the filename is the file name of the snapshot of the file in which theto-be-read data is located, it indicates that the file read request isintended to access to-be-read data of a snapshot.

Step 28: The client server performs a query on a mapping relationshiptable by using the file name, to obtain an FID of a file in which theto-be-read data is located, and performs a query on file metadataaccording to the FID to obtain a file version number.

If the file name is the file name of the file in which the to-be-readdata is located, the file path that in the mapping relationship table isa file path of the file in which the to-be-read data is located, and thefile version number is acquired by performing a query on the metadataaccording to the FID corresponding to the file.

If the file name is the file name of the snapshot, the file path in themapping relationship table is a path in which a snapshot file islocated, and the file version number is acquired by performing a queryon the metadata according to an FID of the snapshot file.

The mapping relationship table records a mapping relationship betweenthe file name and the FID, and the file name is in a one-to-onecorrespondence with the FID. For descriptions of the FID and arelationship between the FID and the file version number, refer to step21 and step 22. The storage location of the mapping relationship tablemay be carried in the file read request and is obtained by the clientserver from the read request, or the mapping relationship table may beprestored in the client server by the client server, and the clientserver finds the mapping relationship table according to the file path,or the mapping relationship table may be stored in another storagedevice.

Referring to step 22, according to different specific cases, themetadata may be stored in the inode of the file or may be stored in theroot inode of the file system.

There is a one-to-one correspondence between a snapshot ID and the fileversion number, so that the client server can obtain the file versionnumber according to the snapshot ID. This correspondence may be storedin the file metadata.

Step 29: The client server processes the file read request and convertsthe file read request into multiple read requests that include a stripread request, where each strip read request is used to request to read astrip, and the strip read request is used to request to read ato-be-read strip from the OSD; and determines an object ID correspondingto each read request, where the strip read request carries a versionnumber of the to-be-read strip, an offset of the to-be-read strip, asize of the to-be-read strip, and an object ID of the to-be-read strip.

Specifically, an offset of each strip that needs to be read, includingthe to-be-read strip, may be learned according to the size of theto-be-read data and the offset of the to-be-read data.

Referring to a method for generating a strip in step 23, theto-be-written data may be split into a strip according to a strip sizeand by using the offset of the to-be-read data and a size of theto-be-written data, to obtain the offset of the to-be-read strip.According to the same method, in this step, the offset of each stripthat needs to be read may also be obtained by using a strip size, theoffset of the to-be-read data, and a length of the to-be-read data. Thestrip size may come from the inode of the file, and in this case,different files may use different strip sizes, or all files in an entiresystem share one strip size.

After the offset of the to-be-read strip is obtained, an ID of an objectin which the to-be-read strip is located may be obtained according to amethod that is the same as that in step 23. It should be noted that,regardless of whether the file name is the file name of the file inwhich the to-be-read data is located or the file name of the snapshot,an FID used for querying the object ID corresponding to the read requestis the FID of the file in which the to-be-read data is located.

Step 30: The client server selects an OSD used to receive the strip readrequest.

Specifically, this step may be executed by the object storage client ofthe client server.

A strip read request and a strip write request of a same strip need tobe corresponding to a same OSD. A feasible method is: using an OSDselection calculation method that is the same as that in step 24.

Step 31: The client server sends the strip read request to the OSDselected in step 30.

The version number of the to-be-read strip is actually a version numberof a file to which the to-be-read strip belongs.

Optionally, a write mode may be further sent to the OSD, where the writemode is consistent with the write mode carried in the strip writerequest in step 25. The object ID of the to-be-read strip is the ID ofthe object to which the to-be-read strip belongs.

Step 32: The OSD receives the strip read request, searches for a storagelocation of the to-be-read strip, and sends the to-be-read strip to theclient server.

The storage location of the to-be-read strip may be a start address ofthe to-be-read strip, and starting from the start address, data of onestrip size is read, and the read data is the to-be-read strip.

In step 26, the strip is written in multiple possible manners.Therefore, the OSD may read the to-be-read strip in correspondingmanners, which are also separately described in the following. In amethod for determining whether a strip/an object is backed up, the flagbit described in step 26 may be used. For example, if the flag bit is 1,it indicates that the strip/the object is backed up, and if the flag bitis 0, it indicates that the strip/the object is not backed up.

For COW, there may be a special case. If the version number carried inthe strip read request is a base version number, a manner for readingthe to-be-read strip in the special case is different from another case,which is equivalent to specifying the base version number as the largestversion number (even if a value of the base version number is 0).Therefore, for example, in a case in which the version number describedin step 26 is 0, because the version number is already the largestversion number, it may not be required to determine whether a stripdetermined by using a key parameter of the to-be-read strip is backedup, data in this storage location is directly read and used as theto-be-read strip, and the to-be-read strip is sent to the client server.In other cases, the to-be-read strip may be read in the following twomanners. Except this special case, the other cases may be divided intothe following two manners.

Manner 1: A Granularity of a Backup Mark of Data in the OSD is a Strip.

It is determined whether a strip determined by using a strip keyparameter carried in the to-be-read strip is backed up. In other words,it is determined whether a strip in a storage location determined byusing the object ID of the to-be-read strip, the to-be-read strip, andthe offset of the to-be-read strip is backed up. In this step, theoffset of the to-be-read strip may be converted into an identifier ofthe to-be-read strip in the object to which the to-be-read stripbelongs. For a conversion method, refer to Manner 1 in step 26.

If the strip is backed up, the strip determined by using the object IDof the to-be-read strip, the to-be-read strip, and the offset of theto-be-read strip is read and used as the to-be-read strip, and theto-be-read strip is sent to the client server.

If the strip is not backed up, it is determined whether, in an objectset of the object ID of the to-be-read strip, there is valid data instrip data in a previous snapshot object until valid strip data isfound.

Specifically, objects that belong to the object set of the object ID ofthe to-be-read strip and whose snapshot times are earlier than asnapshot time of the to-be-read strip are searched one by one by usingthe offset of the to-be-read strip and according to a descending orderof the snapshot times of the objects until a strip that is marked asbacked up is found, the found strip is used as the to-be-read strip, andthe to-be-read strip is sent to the client server, where the snapshottime of the object refers to a time of the latest snapshot that is takenbefore this object is generated and that is of a file or a file systemthat includes this file.

If a later snapshot time indicates a larger snapshot version number,searching is performed according to the descending order of the snapshottimes of the objects. Specifically, for ROW, searching is performedaccording to a descending order of version numbers; for COW, searchingis performed according to an ascending order of version numbers.

Certainly, if a larger version number of the to-be-read strip is usedfor a later snapshot time when the strip is written into the OSD, theto-be-read strip is searched for in a reverse order in this step.

Manner 2: A Granularity of a Backup Mark of Data in the OSD is anObject.

A difference between this step and the manner 1 lies in that thegranularity of the backup mark is changed from a strip into an object.

It is determined whether valid data is stored in a storage locationdetermined by using a strip key parameter carried in the to-be-readstrip. In other words, it is determined whether valid data is stored ina storage location (object space) determined by using the object ID ofthe to-be-read strip and the version number of the to-be-read strip.

If there is valid data, valid data determined by using the object ID ofthe to-be-read strip, the version number of the to-be-read strip, andthe offset of the to-be-read strip is read and used as the to-be-readdata, and the to-be-read data is sent to the client server.

If no valid data is stored, objects in the object set are successivelysearched in a manner similar to Manner 1 in this step and according toan ascending order of snapshot version numbers until a snapshot objectthat stores valid data is found, and the to-be-read strip is read fromthe snapshot object according to the offset of the to-be-read strip andis sent to the client server.

FIG. 4 shows a ROW-based strip read solution. As shown in the figure, afile A includes an object 1, an object 2, and an object 3. After theseobjects are stored in an OSD for the first time, version numbers ofthese objects are 0. In FIG. 4, an object 1.0 indicates an object whoseobject ID is 1 and version number is 0. Similarly, an object 3.2indicates an object whose object ID is 3 and version number is 2. Anobject with a solid line indicates that this object is backed up, and anobject with a dashed line indicates that this object is not backed up.

In this embodiment, after the first snapshot (whose version number is 1)is taken, data of the object 1 is not updated, the object 2 and theobject 3 are backed up, and the object 1 is not backed up. After thesecond snapshot (whose version number is 2) is taken, the object 3 isbacked up, and the object 1 and the object 2 are not backed up. Afterthe third snapshot (whose version number is 3) is taken, the object 1 isbacked up, and the object 2 and the object 3 are not backed up.

It may be learned from a concept of an object set that, an object set inwhich the object 1.0 is located includes the object 1.0 and an object1.3. An object set in which the object 2.0 is located includes an object2.0 and an object 2.1. An object set in which an object 3.0 is locatedincludes the object 3.0, an object 3.1, and an object 3.2.

A direction of arrows in FIG. 4 marks a searching relationship ofobjects. If a strip read request is intended to read a strip in anobject 1.2, it can be learned from the figure that this object is notbacked up, and according to a descending order of version numbers, theobject 1.0 is backed up, and therefore, a strip in the object 1.0 isread. Based on a same principle, if the strip read request is intendedto read a to-be-read strip in an object 2.2 or an object 2.3, data inthe object 2.1 is actually read. Certainly, if the strip read request isintended to read data in the object 1.3 or the object 2.1 or the object3.2, because these objects are backed up, the data can be directly read.

FIG. 5 shows a COW-based strip read solution, and what is different fromFIG. 4 is that a searching order is reverse, and searching is performedaccording to an ascending order of version numbers.

If a granularity of a backup mark is a strip, a principle of thissolution is similar to those in FIG. 4 and FIG. 5, and a difference liesin that a target marked by the backup mark is a strip in an object, butnot an object.

In the foregoing Manner 1 or Manner 2, a client server receives datareturned by a strip read request and data returned by another readrequest, and may generate to-be-read data by splicing the returned data.

As shown in FIG. 6, FIG. 6 shows hardware for executing the foregoingmethod. An interface 413 of a client server 41 is connected to aninterface 423 of an object storage device 42, where the client server 41includes a processor 411, a storage medium 412, and the interface 413,and the processor 411 is connected to the storage medium 412 and theinterface 413. The storage medium 412 is, for example, a memory, andstores a computer program. The processor 411 runs the program in thestorage medium 412 to execute steps executed by the client server in theforegoing method. The interface 413 provides an interface connected tothe OSD, for example, sends a strip read request or a strip writerequest to the OSD. A persistent memory may not be disposed in theclient server 41, that is, all information that is related to theforegoing method and needs to be recorded in the client server 41 may berecorded in the volatile storage medium 412 of the client server 41.

The OSD 42 includes a processor 421, a storage medium 422, the interface423, and a hard disk 424, where the processor 421 is connected to thestorage medium 422 and the interface 423, and the hard disk 424 isconnected to the storage medium 422. The storage medium 422 may be avolatile medium, for example, a memory, where the storage medium 422stores a computer program. The processor 421 runs the program in thestorage medium 422 to execute steps executed by the object storagedevice in the foregoing method. The interface 423 provides an interfaceconnected to the OSD. For example, the interface 423 sends a strip readrequest or a strip write request to the OSD. The hard disk 424 providespersistent storage for a strip. For example, a non-volatile storagemedium generally provides physical storage space for a to-be-writtenstrip/object, and stores a to-be-read strip/object. The hard disk 424may be replaced with another medium such as a flash memory, or anerasable compact disc.

Referring to FIG. 7, FIG. 7 is a structural diagram of a data processingsystem according to an embodiment of the present invention.

The data processing system includes a client serving apparatus 51 and anobject storage apparatus 52. The client serving apparatus 51 may be aphysical device such as a server, or may be a virtual module implementedby software that runs on a server; the object storage apparatus 52 maybe a physical device such as an object storage device, or may be avirtual module implemented by software that runs on an object storagedevice. The client serving apparatus 51 may be configured to executesteps executed by the client server in the foregoing method, and theobject storage apparatus 52 may be configured to execute steps executedby the object storage device in the foregoing method.

The client serving apparatus 51 includes a strip request generationmodule 511 and a strip request sending module 512 connected to the striprequest generation module 511, or may further include a snapshot module513 connected to the strip request generation module 511.

The object storage apparatus 52 includes a strip request receivingmodule 521, and a strip storage module 522 and a strip reading module523 that are connected to the strip request receiving module 521. When astrip storage function is being implemented, the strip reading module isnot mandatory. When a strip read function is being implemented, thestrip storage module is not mandatory. The strip request receivingmodule 521 is connected to the strip request sending module 512.

The following continues to specifically describe functions of themodules.

The snapshot module 513 is configured to: create a snapshot, where atarget of the snapshot includes a file; and allocate a snapshot ID tothe snapshot.

The snapshot is created in two manners. In one manner, a snapshot of thefile is created, and the target of the snapshot is a single file. In theother manner, a snapshot of a file system is created, and the target ofthe snapshot is an entire file system, where the file system includesmultiple files. In the two manners, storage locations of file metadataare different.

In the manner of creating the snapshot of the file, the file is selectedto create the snapshot, a snapshot name is set for the file, and if thesnapshot name has not been used, the snapshot ID is allocated to thesnapshot of the file. The snapshot ID of the file is used as metadata ofthe file and stored in an inode (index node) of the file. It should benoted that the snapshot ID is a mark of the snapshot. For example, atime point for creating the snapshot is used as the snapshot ID, orincreasing numbers are used as snapshot IDs according to an order oftime points for creating snapshots.

In the manner of creating the snapshot of the file system, the filesystem is selected to take the snapshot, and if a snapshot name has notbeen used, the snapshot ID is allocated to the snapshot of the filesystem, and then the allocated snapshot ID is stored in a root inode ofthe file system. In this manner, it may be considered that a snapshot IDof each file in the file system is the same as the snapshot ID of thefile system. A difference between this manner and the previous manner isthat the snapshot ID of the file is stored in the root inode of the filesystem, but not in the inode of the file.

In addition to the snapshot ID of the file, the file metadata furtherincludes a file identifier (FID), and the file metadata may furtherinclude information such as a file size and a writing time.

It should be noted that the snapshot module 513 is optional. Thisembodiment of the present invention mainly describes operationsperformed by the client serving apparatus and the object storageapparatus after a snapshot is created and before a next snapshot iscreated.

The strip request generation module 511 is configured to receive a filewrite request, where the file write request carries to-be-written data,an offset of the to-be-written data, and a file name, and theto-be-written data is a part of a file.

Specifically, a function of the strip request generation module 511 maybe executed by a program in a file system of the client server. The filewrite request is a write request that can be identified by the filesystem. The file write request may be creating a file, or using theto-be-written data to update a file that already exists, where theto-be-written data is a part of the file or the entire file.

The file write request may further carry a size of the to-be-writtendata, so that the to-be-written data is subsequently split into a stripaccording to the offset of the to-be-written data; or may not carry asize of the to-be-written data, because the size of the to-be-writtendata can be obtained by measuring the to-be-written data.

The offset of the to-be-written data describes a relative location ofthe to-be-written data in the file. Specifically, the offset of theto-be-written data may describe a distance between a start location ofthe to-be-written data and a file header. If the offset of theto-be-written data is 0, it indicates that the start location of theto-be-written data is a start location of a to-be-written file. If theoffset of the to-be-written data is 1 KB, it indicates that a distancebetween the start location of the to-be-written data and the startlocation of the file is a data size of 1 KB.

Optionally, the file write request may further carry a file path of thefile write request, where the file path indicates storage locations ofthe file and a mapping relationship table. A file is jointly determinedby using a file path and a file name. For example, a combination of thefile path and the file name is /root/mma/a1, where /root/mma/ is thefile path, a1 is the file name, and the file and the mappingrelationship table are stored in the path /root/mma/.

Different files may have different file names, and file names in a samefile path are not the same.

Optionally, the write request may further carry a storage location of amapping relationship table, where the mapping relationship table recordsa mapping relationship between the file name and the FID.

Before a query is performed on the mapping relationship table by usingthe file name, a mapping relationship between the snapshot ID and a fileversion number may be recorded, and the following two operations may beexecuted.

(1) Back up currently newest file metadata, which may be specificallyimplemented by backing up an inode. For a snapshot of a file level, aninode of a file is backed up, and if a snapshot of a file system iscreated, an inode of the file system is backed up, including both aninode of a file and a root inode of the file.

(2) Update a version number in the inode. If a write mode that is set inthe client server is ROW, the updated version number is stored in thebacked-up inode. If a write mode that is set in the client server isCOW, the updated version number is stored in an inode that is generatedby means of backup, and optionally, the backed-up inode may also recordthe updated version number. For example, if an inode A is backed up togenerate an inode B, the inode A is a backed-up inode, and the inode Bis an inode that is generated by means of backup.

There is a correspondence between the file version number and thesnapshot ID, and the snapshot ID is corresponding to a snapshot time;therefore, it may also be considered that there is a correspondencebetween the file version number and the snapshot time. Thecorrespondence means that each file version number is corresponding to aunique snapshot ID, and a change rule of the file version number issimilar to that of the snapshot ID. For example, a larger snapshot IDindicates a larger file version number, or a larger snapshot IDindicates a smaller file version number. A snapshot with a latersnapshot time among multiple snapshots has a larger ID.

It should be noted that, in a data writing technology based on a blocksystem, including a SAN, a volume is marked by using a volume ID insteadof a file name, and a function of the volume ID is similar to that ofthe FID. In addition, in the volume, there is no concept similar to thefile path. Therefore, a query is no longer required to be performed onthe mapping relationship table, and a query may be directly performed onvolume metadata by using a volume ID to obtain a file version number.

The strip request generation module 511 is further configured to:perform a query on a mapping relationship table by using the file name,to obtain a file identifier (FID) of the file in which the to-be-writtendata is located, and perform a query on file metadata according to theFID to obtain a file version number.

The mapping relationship table records a mapping relationship betweenthe file name and the FID, and the file name is in a one-to-onecorrespondence with the FID. The storage location of the mappingrelationship table may be carried in the file write request and isobtained by the client server from the write request, or the mappingrelationship table may be prestored in the client server by the clientserver, and the client server finds the mapping relationship tableaccording to the file path, or the mapping relationship table may bestored in another storage device.

The strip request generation module 511 may further update the obtainedfile version number to the metadata. After the update, the file metadatarecords the FID and the file version number, and the file version numbermay be obtained by performing a query on the file metadata by using theFID. The file metadata may be stored in information about an inode. Thefile path indicates a storage location of the inode. It can be learnedfrom the foregoing that, in ROW, because the version number is stored inthe backed-up inode, the strip request generation module 511 reads thebacked-up inode; in COW, because the version number is stored in theinode that is generated by means of backup, the strip request generationmodule 511 reads the inode that is generated by means of backup.

There is a one-to-one correspondence between the file version number andthe snapshot ID of the file, and after generating the snapshot ID, theclient server generates the file version number that is in a one-to-onecorrespondence with the snapshot ID. For example, the snapshot ID may bedirectly used as the file version number, or a snapshot ID obtainedafter an operation is performed may be used as the file version number.If a snapshot that is created later has a larger snapshot ID, anoptional manner is: the snapshot that is created later has a largervalue of the snapshot ID; another optional manner is: the snapshot thatis created later has a smaller value of the snapshot ID.

The strip request generation module 511 is further configured to: splitthe to-be-written data into multiple strips that include a to-be-writtenstrip (strip), and obtain, according to a strip distribution policy, anoffset of the to-be-written strip and an ID of an object to which theto-be-written strip belongs, where this ID is also referred to as anobject ID.

The client server splits the data into one or more strips according to astrip size. A strip is data of a particular size. When the size of theto-be-written data is less than or equal to a size of a single strip,the to-be-written data is split into one strip; if the size of theto-be-written data is greater than the size of the single strip, theto-be-written data is split into multiple strips. Sizes of strips splitfrom a same file are the same. The strip size may be stored in the filemetadata, and in this case, different files may use different stripsizes. Alternatively, the strip size may not be stored in the metadataof the file to which the object belongs, files in the entire file systemshare one strip size, and in this case, different files use a same stripsize, and the strip size is stored in the root inode of the file system.An object may be considered as a container, which can accommodate astrip.

For example, if the to-be-written data is split into several datastrips, the strip generated by means of splitting refers to a data stripobtained by means of splitting; or after the to-be-written data is splitinto a data strip, if several verification strips are further generatedto perform data protection on the data strip, the strip generated bymeans of splitting includes both the data strip and the verificationstrip.

A total quantity of strips included in each object may be stored in thefile metadata, and in this case, a total quantity of strips included inobjects in different files may be different; or a total quantity ofstrips included in each object may not be stored in the metadata of thefile to which the object belongs, and in this case, a total quantity ofstrips included in objects in different files is the same.

It should be noted that a start location of the to-be-written data inthe file may be learned from the offset of the to-be-written data, andan end location of the to-be-written data in the file may be learnedfrom the offset of the to-be-written data and the size of theto-be-written data. If the start location of the to-be-written data isnot an integer multiple of the strip size, or a value of an offset ofthe end location plus 1 is not an integer multiple of the strip size,the to-be-written data is first split according to the strip size, andsplitting boundaries are integer multiples of the strip size. If datawhose size is less than one strip (this type of data may also bereferred to as dirty data of a strip) is generated after splitting, thedata is supplemented to form a strip. Because of a supplementingoperation performed by the strip request generation module 511, unlessotherwise specified, both a strip and an offset of the strip that aresubsequently mentioned refer to a strip and an offset of the strip thatare obtained after supplementing.

For example, if an offset range of the to-be-written data is 4 KB-300KB, and the strip size is 256 KB, 0 KB and 256 KB are used as boundariesfor splitting the to-be-written data, and two data blocks are formed,where offset ranges of the two data blocks in the to-be-written data arerespectively 4 KB-255 KB and 256 KB-300 KB. Supplementing is performedon the two data blocks, and two strips whose sizes are 256 KB areformed. Data (whose size is 4 KB−0 KB=4 KB) used to supplement a formerdata block comes from a previous strip, and data (whose size is 511KB−300 KB=211 KB) used to supplement a latter data block comes from anext strip. The offset of the to-be-written data is a relative locationof the to-be-written data in the file.

Another supplementing method is as follows: If the start location of theto-be-written data is not an integer multiple of the strip size, or avalue of an end location offset plus 1 is not an integer multiple of thestrip size, a supplementing operation may be performed on theto-be-written data of strip, so that sizes of strips obtained aftersplitting are consistent and there is no margin in the strip. Data thatis already stored in the OSD may be read and used as data forsupplementing.

For example, if an offset range of the to-be-written data is 4 KB-300KB, and the strip size is 256 KB, the to-be-written data may besupplemented to form data whose offset range is 0 KB-511 KB, and thenthe data is split into two strips whose offset ranges are 0 KB-255 KBand 256 KB-511 KB, so that a size of each strip is 256 KB.

The strip distribution policy is provided by the file system of theclient server. The object to which the strip belongs is described, thatis, a correspondence between the strip and the object is described.Specifically, the correspondence may be a correspondence between theoffset of the strip and the object.

An object ID uniquely identifies an object, IDs of objects that belongto a same file are different, and IDs of objects in different files arealso different.

Optionally, there may be a correspondence between the object ID and theFID of the file to which the object belongs. That is, for example, afile from which an object represented by this object ID comes may belearned from the object ID.

For example, an optional manner for generating the object ID is asfollows: The object ID includes binary numbers of 64 bits, where former32 bits are an ID of the file to which the object belongs, latter 32bits are assigned by the client server, the latter 32 bits are unique inthe file, and latter 32 bits of different objects in a same file aredifferent. For example, an identifier of an object in a file is used. Inthis manner, the corresponding FID may be learned from the former 32bits of the object ID. Similarly, in the block (block) system, arelationship between an object ID and a volume ID may also beestablished.

Another optional manner for generating the object ID is as follows: Theobject ID includes binary numbers of 48 bits, where former 16 bits arecorresponding to the file, and former 16 bits of different files aredifferent; latter 32 bits are assigned by the client server, the latter32 bits are unique in the file, and latter 32 bits of different objectsin a same file are different.

In another embodiment, there may also be no correspondence between theID and the FID of the file to which the object belongs.

FIG. 3A and FIG. 3B show two different strip distribution policies. Astrip index describes an offset relationship of a strip in a file, andthe strip index is an integer greater than or equal to 0, where thesmallest strip index is 0, the second smallest strip index is 1, and thethird smallest strip index is 2, . . . , and so on. Two strips withadjacent index values also have adjacent offsets in the file.

An optional strip distribution policy is shown in FIG. 3A: (1) sizes ofobjects that belong to a same file are fixed, and sizes of strips in asame file are the same, which means that a total quantity of stripsincluded in different objects is the same; (2) a previous object isfirst filled and then a next object is filled by strips according to anindex order, that is, several consecutive strips belong to a same objectaccording to an order of offset sizes of strips in the to-be-writtendata. As shown in FIG. 3A, each object fixedly includes four strips. Forexample, a strip size is 256 KB, and each object has four strips, thatis, an object size is 256 KB×4=1024 KB. In this case, the first objectstores the strip 0 to strip 3, the second object stores the strip 4 tothe strip 7, and the third object stores the strip 8 to strip 11, . . .and accordingly, an ID of the first object is 0, an ID of the secondobject is 1, and an ID of the third object is 2, . . . .

A strip offset is used to describe a relative location of a strip in anobject, and may be specifically a relative location of start data of thestrip in the object. Strip offset=(Strip index % Quantity of strips inan object)×Strip size, where Strip index % Quantity of strips in anobject refers to calculating a remainder by dividing the strip index bythe quantity of strips in the object.

Another optional strip distribution policy is shown in FIG. 3B: (1)sizes of objects in a same file are not fixed, that is, differentobjects in the same file may have different total quantities of strips;(2) a total quantity of objects is fixed, that is, different files haveobjects of a same quantity, and as shown in FIG. 3B, there are threeobjects in total. For example, if a strip size is 256 KB, and a totalquantity of objects is fixed to 3, the first strip (strip 0) is locatedin the first object (object 0), the second strip (strip 1) is located inthe second object (object 1), . . . , and by analogy, the fourth strip(strip 3) is also located in the first object, and the fifth strip(strip 4) is also located in the second object. A strip index is aninteger greater than or equal to 0, and describes a locationrelationship between strips in a file. An offset of each strip in anobject to which the strip belongs may also be determined, and anidentifier of an object in the file may be rip index is divided by atotal quantity of objects in the file. A specific calculation formulamay be: Identifier of an object in a file=Strip index % Quantity ofobjects in a file, and Strip offset=(Strip index/Quantity ofobjects)×Strip size.

The strip index may be determined by using the offset of theto-be-written data. For example, for an entire file, start data obtainedafter the file is split is located in a strip (strip 0) in the firstobject, and the offset of the current to-be-written data is located inthe fifth strip (strip 4) in the object 1. In this case, in stripsgenerated after the to-be-written data is split, an index of the firststrip is 4, and an index of another strip is obtained by analogy.

The foregoing describes two solutions for calculating the ID of theobject to which the strip belongs, and according to different stripdistribution policies, there may also be another implementationsolution. Parameters used in different distribution policies may bedifferent, and these parameters may be generally obtained by performinga query on the client server.

Because processing manners of all strips are the same, the followinguses only a “to-be-written strip” as an example for description.

The strip request sending module 512 is configured to select an OSD usedto store the to-be-written strip.

An optional calculation method is determining, according to the FID ofthe to-be-written strip, the OSD for storing the to-be-written strip.For example, a hash value of the FID is divided by a total quantity ofOSDs, and a remainder is used as an identifier of the OSD for storingthe to-be-written strip, that is, the hash value of the FID mod thetotal quantity of OSDs. There may also be another solution. For example,the client server randomly selects an OSD to store a to-be-written stripthat belongs to an object, and strips that belong to a same object maybe stored in a same OSD.

In addition, the OSD for storing the strip may also be jointlydetermined according to the FID and an object ID that are of theto-be-written strip. Actually, a calculation method may be randomlyselected provided that an OSD can be selected.

The strip request sending module 512 is further configured to send astrip write request to the OSD, where the strip write request carriesthe to-be-written strip, a version number of the to-be-written strip, asize of the to-be-written strip, the offset of the to-be-written strip,and the ID of the object to which the to-be-written strip belongs.

Optionally, in a case in which the OSD supports both ROW and COW, awrite mode may be further sent, so that the OSD writes the to-be-writtenstrip according to the write mode specified by the client server. Thewrite mode is ROW or COW. If the OSD supports only one write mode, thewrite mode may not be sent to the OSD.

The strip request receiving module 521 is configured to receive thestrip write request and write the to-be-written strip into a storagemedium of the OSD.

The strip request receiving module 521 may execute the method in step26. For example, writing of the to-be-written strip may be implementedin one or more of four manners.

The strip request generation module 511 may be further configured toreceive a file read request, where the file read request carries a filename, a size of to-be-read data, and an offset of the to-be-read data.

Similar to the file write request, the file read request may furthercarry a file path of the file read request, where the file path recordsa storage location of a mapping relationship table. A file may beuniquely determined by using the file path and the file name.

Specifically, this step may be executed by a program in the file systemof the client server. The file read request is a read request that canbe identified by the file system. The file read request requests to reada complete file or a part of data of a file.

The offset of the to-be-read data describes a relative location of theto-be-read data in the file. Specifically, the offset of the to-be-readdata may describe a distance between a start location of the to-be-readdata and a file header. If the offset of the to-be-read data is 0, itindicates that the start location of the to-be-read data is a startlocation of a to-be-read file. If the offset of the to-be-read data is 2KB, it indicates that a distance between the start location of theto-be-read data and the start location of the file is a data size of 2KB.

Optionally, the file read request may further carry a file path, wherethe file path records a storage location of a mapping relationshiptable. For details of the mapping relationship table, refer to thedescription of step 21.

The file name may be a file name of a file in which the to-be-read datais located, or may be a file name of a snapshot of a file in which theto-be-read data is located. If the file name is the file name of thefile in which the to-be-read data is located, it indicates that the fileread request is intended to access newest to-be-read data; if the filename is the file name of the snapshot of the file in which theto-be-read data is located, it indicates that the file read request isintended to access to-be-read data of a snapshot. The strip storagemodule 522 is configured to: perform a query on a mapping relationshiptable by using the file name, to obtain an FID of a file in which theto-be-read data is located, and perform a query on file metadataaccording to the FID to obtain a file version number.

If the file name is the file name of the file in which the to-be-readdata is located, the file path that stores the mapping relationshiptable is a file path of the file in which the to-be-read data islocated, and the file version number is acquired by performing a queryon the metadata according to the FID corresponding to the file.

If the file name is the file name of the snapshot, the file path in themapping relationship table is a path in which a snapshot file islocated, and the file version number is acquired by performing a queryon the metadata according to an FID of the snapshot file.

The mapping relationship table records a mapping relationship betweenthe file name and the FID, and the file name is in a one-to-onecorrespondence with the FID. For descriptions of the FID and arelationship between the FID and the file version number, refer to step21 and step 22. The storage location of the mapping relationship tablemay be carried in the file read request and is obtained by the clientserver from the write request, or the mapping relationship table may beprestored in the client server by the client server, and the clientserver finds the mapping relationship table according to the file path,or the mapping relationship table may be stored in another storagedevice.

Referring to step 22, according to different specific cases, themetadata may be stored in the inode of the file or may be stored in theroot inode of the file system.

There is a one-to-one correspondence between a snapshot ID and the fileversion number, so that the client server can obtain the file versionnumber according to the snapshot ID. This correspondence may be storedin the file metadata.

The strip request generation module 511 may be further configured to:process the file read request and convert the file read request intomultiple read requests that include a strip read request, where eachstrip read request is used to request to read a strip, and the stripread request is used to request to read a to-be-read strip from the OSD;and determine an object ID corresponding to each read request, where thestrip read request carries a version number of the to-be-read strip, anoffset of the to-be-read strip, a size of the to-be-read strip, and anobject ID of the to-be-read strip.

Specifically, an offset of each strip that needs to be read, includingthe to-be-read strip, may be learned according to the size of theto-be-read data and the offset of the to-be-read data.

Referring to a method for generating a strip in step 23, theto-be-written data may be split into a strip according to a strip sizeand by using the offset of the to-be-written data and a length of theto-be-written data, to obtain the offset of the to-be-read strip.According to the same method, in this step, the offset of each stripthat needs to be read may also be obtained by using a strip size, theoffset of the to-be-read data, and a length of the to-be-read data. Thestrip size may come from the inode of the file, and in this case,different files may use different strip sizes, or all files in an entiresystem share one strip size.

After the offset of the to-be-read strip is obtained, an ID of an objectin which the to-be-read strip is located may be obtained according to amethod that is the same as that in step 23. It should be noted that,regardless of whether the file name is the file name of the file inwhich the to-be-read data is located or the file name of the snapshot,an FID used for querying the object ID corresponding to the read requestis the FID of the file in which the to-be-read data is located.

The strip request sending module 512 may be further configured to selectan OSD used to receive the strip read request.

Specifically, this step may be executed by the object storage client ofthe client server.

A strip read request and a strip write request of a same strip need tobe corresponding to a same OSD. A feasible method is: using an OSDselection calculation method that is the same as that in step 24.

The strip request sending module 512 may be further configured to sendthe strip read request to the selected OSD.

The version number of the to-be-read strip is a version number of a fileto which the to-be-read strip belongs.

Optionally, a write mode may be further sent to the OSD, where the writemode is consistent with the write mode carried in the strip writerequest in step 25. The object ID of the to-be-read strip is the ID ofthe object to which the to-be-read strip belongs.

The strip request receiving module 521 may be further configured to:receive the strip read request, search for a storage location of theto-be-read strip, and send the to-be-read strip to the client servingapparatus.

The strip request receiving module 521 may implement a function in step32, for example, reads the to-be-read strip in Manner 1 or Manner 2mentioned in step 32. Therefore, for a specific function of the striprequest receiving module 521, reference may be made to step 32.

Each aspect of the present invention or a possible implementation mannerof each aspect may be specifically implemented as a system, a method, ora computer program product. Therefore, each aspect of the presentinvention or a possible implementation manner of each aspect may useforms of hardware only embodiments, software only embodiments (includingfirmware, resident software, and the like), or embodiments with acombination of software and hardware, which are uniformly referred to as“circuit”, “module”, or “system” herein. In addition, each aspect of thepresent invention or the possible implementation manner of each aspectmay take a form of a computer program product, where the computerprogram product refers to computer-readable program code stored in acomputer-readable medium.

The computer-readable medium may be a computer-readable signal medium ora computer-readable storage medium. The computer-readable storage mediumincludes but is not limited to an electronic, magnetic, optical,electromagnetic, infrared, or semi-conductive system, device, orapparatus, or any appropriate combination thereof, such as a randomaccess memory (RAM), a read-only memory (ROM), an erasable programmableread only memory (EPROM or flash memory), an optical fiber, and acompact disc read only memory (CD-ROM).

A processor in a computer reads computer-readable program code stored ina computer-readable medium, so that the processor can perform a functionand an action specified in each step or a combination of steps in aflowchart; an apparatus is generated to implement a function and anaction specified in each block or a combination of blocks in a blockdiagram.

What is claimed is:
 1. A data storage method in object storage, the datastorage method comprises: receiving, by an object storage device (OSD),a strip write request sent by a client server, wherein the strip writerequest comprises a to-be-written strip, a version number of theto-be-written strip, an offset of the to-be-written strip, and an objectID of the to-be-written strip, the version number of the to-be-writtenstrip is corresponding to a snapshot ID of a latest snapshot of a fileor a volume to which the to-be-written strip is located, the offset ofthe to-be-written strip describes a location of the to-be-written stripin an object to which the to-be-written strip is located, the object IDof the to-be-written strip is an ID of the object to which theto-be-written strip belongs, the file or the volume comprises the objectwith the object ID and other object, the object with the object IDcomprises the to-be-written strip and other strip, wherein snapshotobjects of an object have same object IDs and different version numbers,the snapshot object is identified by a combination of the object ID andthe version number; and writing, by the OSD, the to-be-written stripinto a location in a target object, wherein the target object isidentified by the version number of the to-be-written strip and theobject ID, the location in the target object is determined by the offsetof the to-be-written strip, wherein when updating data in the file orthe volume to which the to-be-written strip is located, the object IDcorresponding to the updated data is not changed, and the version numbercorresponding to the updated data is updated.
 2. The data storage methodaccording to claim 1, wherein before receiving the strip write requestsent by the client server, the data storage method further comprises:taking, by the client server, a snapshot of the file or the volume towhich the to-be-written strip belongs, and generating the snapshot ID ofthe latest snapshot; and generating the version number of theto-be-written strip according to the snapshot ID of the latest snapshot.3. The data storage method according to claim 2, wherein the datastorage method further comprises: updating, by the client server, theversion number of the to-be-written strip to metadata of the file or thevolume.
 4. The data storage method according to claim 1, wherein beforethe receiving, by an OSD, a strip write request, the data storage methodfurther comprises: receiving, by the client server, a file writerequest, wherein the file write request carries to-be-written data, anoffset of the to-be-written data, and a file name, and the to-be-writtendata is a part of the file; obtaining, by the client server, a fileidentifier FID according to the file name, performing a query on themetadata of the file according to the FID to obtain a version number ofthe file, and using the version number of the file as the version numberof the to-be-written strip, wherein the version number of the file iscorresponding to the snapshot ID of the latest snapshot of the file towhich the to-be-written strip belongs; splitting, by the client serveraccording to the offset of the to-be-written data and a size of theto-be-written data, the to-be-written data into multiple strips thatcomprise the to-be-written strip, determining the ID of the object towhich the to-be-written strip belongs, and obtaining the offset of theto-be-written strip; and creating the strip write request.
 5. The datastorage method according to claim 1, wherein before the receiving, by anOSD, a strip write request, the data storage method further comprises:receiving, by the client server, a volume write request, wherein thevolume write request carries to-be-written data, an offset of theto-be-written data, and a volume identifier ID, and the to-be-writtendata is a part of the volume; performing, by the client server, a queryon the metadata of the volume according to the volume ID to obtain aversion number of the volume, and using the version number of the volumeas the version number of the to-be-written strip, wherein the versionnumber of the volume is corresponding to the snapshot ID of the latestsnapshot of the volume to which the to-be-written strip belongs;splitting, by the client server according to the offset of theto-be-written data and a size of the to-be-written data, theto-be-written data into multiple strips that comprise the to-be-writtenstrip, determining the ID of the object to which the to-be-written stripbelongs, and obtaining the offset of the to-be-written strip; andcreating the strip write request.
 6. The data storage method accordingto claim 1, wherein the latest snapshot comprises snapshot objects ofthe object with the object ID and the other object.
 7. A data storagemethod in object storage, the data storage method comprises: receiving,by an object storage device (OSD), a strip write request sent by aclient server, wherein the strip write request carries a to-be-writtenstrip, a version number of the to-be-written strip, an offset of theto-be-written strip, and an object ID of the to-be-written strip, theversion number of the to-be-written strip is corresponding to a snapshotID of a latest snapshot of a file or a volume to which the to-be-writtenstrip is located, the offset of the to-be-written strip describes alocation of the to-be-written strip in an object to which theto-be-written strip is located, the object ID of the to-be-written stripis an ID of the object to which the to-be-written strip belongs, thefile or the volume comprises the object with the object ID and otherobject, the object with the object ID comprises the to-be-written stripand other strip, wherein snapshot objects of an object have same objectIDs and different version numbers, the snapshot object is identified bya combination of the object ID and the version number; determining, bythe OSD, whether a target object determined by using the version numberof the to-be-written strip and the object ID is backed up; and when thetarget object is backed up, writing, by the OSD, the to-be-written stripinto a storage location in the target object, wherein the storagelocation in the target object is determined by the offset of theto-be-written strip; when the target object is not backed up, creating,by the OSD, a spliced object by the to-be-written strip, and thenwriting the spliced object into a storage location identified by usingthe version number of the to-be-written strip and the object ID, whereinwhen updating data in the file or the volume to which the to-be-writtenstrip is located, the object ID corresponding to the updated data is notchanged, and the version number corresponding to the updated data isupdated.
 8. The data storage method according to claim 7, wherein thecreating, by the OSD, a spliced object by using the to-be-written stripspecifically comprises: selecting, by the OSD, an object with a latestsnapshot time from a backed-up object that belongs to an object set ofthe object ID of the to-be-written strip, to obtain a strip whose offsetis different from the offset of the to-be-written strip, and jointlyconstituting the spliced object by using the to-be-written strip and thestrip whose offset is different from the offset of the to-be-writtenstrip, wherein a set of an object that is stored in the OSD and whoseobject ID is the same as the object ID of the to-be-written strip andversion number is different from the version number of the to-be-writtenstrip is referred to as the object set of the object ID of theto-be-written strip.
 9. The data storage method according to claim 7,wherein before the receiving a strip write request sent by a clientserver, the data storage method further comprises: taking, by the clientserver, a snapshot of the file or the volume to which the to-be-writtenstrip belongs, and generating the snapshot ID of the latest snapshot;generating the version number of the to-be-written strip according tothe snapshot ID of the latest snapshot; and updating, by the clientserver, the version number of the to-be-written strip to metadata of thefile or the volume.
 10. The data storage method according to claim 7,wherein the latest snapshot comprises snapshot objects of the objectwith the object ID and the other object.
 11. An object storage devicefor object storage, comprising a processor, and a non-transitory storagemedium and an interface that are connected to the processor, wherein:the interface is configured to receive a strip write request sent by aclient server, wherein the strip write request carries a to-be-writtenstrip, a version number of the to-be-written strip, an offset of theto-be-written strip, and an object ID of the to-be-written strip, theversion number of the to-be-written strip is corresponding to a snapshotID of a latest snapshot of a file or a volume to which the to-be-writtenstrip belongs, the offset of the to-be-written strip describes alocation of the to-be-written strip in an object to which theto-be-written strip is located, the object ID of the to-be-written stripis an ID of the object to which the to-be-written strip is located, thefile or the volume comprises the object with the object ID and otherobject, the object with the object ID comprises the to-be-written stripand other strip; the non-transitory storage medium stores a computerprogram; and by running the computer program, the processor isconfigured to: write the to-be-written strip into a location in a targetobject, wherein the target object is identified by the version number ofthe to-be-written strip and the object ID, the storage location in thetarget object is determined by the offset of the to-be-written strip,wherein when updating data in the file or the volume to which theto-be-written strip is located, the object ID corresponding to theupdated data is not changed, and the version number corresponding to theupdated data is updated.
 12. The data storage device according to claim11, wherein before receiving the strip write request sent by the clientserver, the processor is further configured to: take a snapshot of thefile or the volume to which the to-be-written strip belongs, andgenerate the snapshot ID of the latest snapshot; and generate theversion number of the to-be-written strip according to the snapshot IDof the latest snapshot.
 13. The data storage device according to claim12, wherein the processor is further configured to: update the versionnumber of the to-be-written strip to metadata of the file or the volume.14. The data storage device according to claim 11, wherein beforereceiving the strip write request: the interface is further configuredto receive a file write request, wherein the file write request carriesto-be-written data, an offset of the to-be-written data, and a filename, and the to-be-written data is a part of the file; and theprocessor is further configured to: obtain a file identifier FIDaccording to the file name, performing a query on the metadata of thefile according to the FID to obtain a version number of the file, andusing the version number of the file as the version number of theto-be-written strip, wherein the version number of the file iscorresponding to the snapshot ID of the latest snapshot of the file towhich the to-be-written strip belongs; split, according to the offset ofthe to-be-written data and a size of the to-be-written data, theto-be-written data into multiple strips that comprise the to-be-writtenstrip, determine the ID of the object to which the to-be-written stripbelongs, and obtain the offset of the to-be-written strip; and createthe strip write request.
 15. The data storage device according to claim11, wherein before receiving the strip write request: the interface isfurther configured to receive a volume write request, wherein the volumewrite request carries to-be-written data, an offset of the to-be-writtendata, and a volume identifier ID, and the to-be-written data is a partof the volume; and the processor is further configured to perform aquery on the metadata of the volume according to the volume ID to obtaina version number of the volume, and use the version number of the volumeas the version number of the to-be-written strip, wherein the versionnumber of the volume is corresponding to the snapshot ID of the latestsnapshot of the volume to which the to-be-written strip belongs; split,according to the offset of the to-be-written data and a size of theto-be-written data, the to-be-written data into multiple strips thatcomprise the to-be-written strip, determine the ID of the object towhich the to-be-written strip belongs, and obtain the offset of theto-be-written strip; and create the strip write request.
 16. The objectstorage device according to claim 11, wherein the latest snapshotcomprises snapshot objects of the object with the object ID and theother object.
 17. An object storage device, comprising a processor, anda non-transitory storage medium and an interface that are connected tothe processor, wherein: the interface is configured to receive a stripwrite request sent by a client server, wherein the strip write requestcarries a to-be-written strip, a version number of the to-be-writtenstrip, an offset of the to-be-written strip, and an object ID of theto-be-written strip, the version number of the to-be-written strip iscorresponding to a snapshot ID of a latest snapshot of a file or avolume to which the to-be-written strip is located, the offset of theto-be-written strip describes a location of the to-be-written strip inan object to which the to-be-written strip is located, the object ID ofthe to-be-written strip is an ID of the object to which theto-be-written strip belongs, the file or the volume comprises the objectwith the object ID and other object, the object with the object IDcomprises the to-be-written strip and other strip, wherein snapshotobjects of an object have same object IDs and different version numbers,the snapshot object is identified by a combination of the object ID andthe version number; the non-transitory storage medium stores a computerprogram; and by running the computer program, the processor isconfigured to: determine whether a target object identified by using theversion number of the to-be-written strip and the object ID is backedup; and when the target object is backed up, the processor is furtherconfigured to write the to-be-written strip into a storage location inthe target object, wherein the storage location in the target object isdetermined by the offset of the to-be-written strip; or when the targetobject is not backed up, the processor is further configured to create aspliced object by using the to-be-written strip, and then write thespliced object into a storage location determined by using the versionnumber of the to-be-written strip and the object ID, wherein whenupdating data in the file or the volume to which the to-be-written stripis located, the object ID corresponding to the updated data is notchanged, and the version number corresponding to the updated data isupdated.
 18. The object storage device according to claim 10, whereinthat the processor is configured to create a spliced object by using theto-be-written strip specifically comprises: the processor is configuredto: select an object with a latest snapshot time from a backed-up objectthat belongs to an object set of the object ID of the to-be-writtenstrip, to obtain a strip whose offset is different from the offset ofthe to-be-written strip, and jointly constitute the spliced object byusing the to-be-written strip and the strip whose offset is differentfrom the offset of the to-be-written strip, wherein: a set of an objectthat is stored in the object storage device and whose object ID is thesame as the object ID of the to-be-written strip and version number isdifferent from the version number of the to-be-written strip is referredto as the object set of the object ID of the to-be-written strip. 19.The data storage device according to claim 17, wherein before receivingthe strip write request sent by the client server, the processor isfurther configured to: take a snapshot of the file or the volume towhich the to-be-written strip belongs, and generate the snapshot ID ofthe latest snapshot; generate the version number of the to-be-writtenstrip according to the snapshot ID of the latest snapshot; and updatethe version number of the to-be-written strip to metadata of the file orthe volume.
 20. The object storage device according to claim 17, whereinthe latest snapshot comprises snapshot objects of the object with theobject ID and the other object.